Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to predict the output for this type of Qs?

 
Padmalatha Kontham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class JJF3 {
public static void main(String args[]) {
System.out.print(Integer.toBinaryString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toOctalString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toHexString(Byte.MAX_VALUE));
}
}

What is the output for this Q?
How to calculate the output for this type of Qs?

Regards,
Latha.K.P
 
Pradeep Kadambar
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Latha,

Put the same code in your eclipse (any IDE) and check the outputs. You can experiment with your code snippets. This will help you rather than the easy volleys thrown by ranchers.

 
Campbell Ritchie
Sheriff
Pie
Posts: 49782
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have preferred to see leading zeroes in the "binary" output, however.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic