Why is Binary represented as a String?
问题 So I am quite new to Java and motivated to learn. This question might seem simple but I genuinely don't understand and have searched Google for answers (no luck). I am converting a decimal into Binary in Java. However, I thought representations of numbers are supposed to be given in data types int , double , and etc. The code is as follows : int decimal = 99; String binary = Integer.toBinaryString(decimal); System.out.println(binary); Why is it String binary , should it not be any of the