It's not a secret anymore!*
The moose likes Beginning Java and the fly likes How to predict the output for this type of Qs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to predict the output for this type of Qs?" Watch "How to predict the output for this type of Qs?" New topic
Author

How to predict the output for this type of Qs?

Padmalatha Kontham
Greenhorn

Joined: Jun 21, 2007
Posts: 6
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

Joined: Oct 18, 2004
Posts: 148
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

Joined: Oct 13, 2005
Posts: 38008
    
  22
I would have preferred to see leading zeroes in the "binary" output, however.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to predict the output for this type of Qs?
 
Similar Threads
doubt
doubt about Danchisholm mock exam papers
operator precedence and associativity
doubt on java fundamental mock exam
why it doesn't print max value of char