This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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
Posts: 48440
56
  • 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