Can anyone tell me why the Output is 10? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can anyone tell me why the Output is 10?

public class Program { public static void main(String[] args) { int r=Integer.parseInt("1010",2); System. out.println (r); } }

31st May 2021, 2:13 PM
Atul [Inactive]
2 Answers
+ 3
31st May 2021, 3:43 PM
Atul [Inactive]
0
1010 is binary number for 10 so your output is 10
1st Jun 2021, 7:43 PM
Jadhav Swati
Jadhav Swati - avatar