Quiz question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quiz question

int a=2; int b=3; System.out.println((Integer.toBinaryString(a))+(Integer.toBinaryString(b))); What is output of code? Can u explain how

28th Jun 2020, 5:54 AM
Haritha Vuppula
Haritha Vuppula - avatar
2 Answers
+ 1
Haritha Vuppula , it converts both integers to binary strings. 2 to binary string is "10", 3 is "11". So the result is "10" + "11" => "1011".
28th Jun 2020, 6:58 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
28th Jun 2020, 7:11 AM
Haritha Vuppula
Haritha Vuppula - avatar