aspose file tools*
The moose likes Beginning Java and the fly likes How would you approach this question... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How would you approach this question..." Watch "How would you approach this question..." New topic
Author

How would you approach this question...

Milan Gupta
Greenhorn

Joined: Aug 03, 2002
Posts: 7
Ran across this in a sample test, seemed like quite a bit of math for test question. Thought there must be some easy way to do this.
class C {
public static void main(String args[]) {
System.out.print(Long.toHexString(Long.MIN_VALUE)+",");
System.out.print(Long.toHexString(Long.MAX_VALUE));
}
}

What is the result of attempting to compile and run the program?
a. Prints: 80000000,7fffffff
b. Prints: 8000000000000000,7fffffffffffffff
c. Prints: 7fffffff,80000000
d. Prints: 7fffffffffffffff,8000000000000000
e. Prints: 00000000,ffffffff
f. Prints: 0000000000000000,ffffffffffffffff
g. Compiler Error
h. Runtime Error
i. None of the Above
Stefan Zoerner
Author
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
... I would compile it and try it out :-)
Greetings from Hamburg,
Stefan


Stefan Zoerner
Author of German LDAP-Book
Committer at Apache Directory Project
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401

I think what it boils down to is that it's one of those things you know because, no doubt, it is some manual about the nature of primitive data types such pg 97 of Just Java 2; or was seen in the
java docs.
But after just looking at all that, I still wouldn't know without actually

... I would compile it and try it out :-)

Now I know, question is: will I remember?
doco
[ April 06, 2003: Message edited by: doco mastadon ]

doco
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Is Long.MIN_VALUE a positive number or a negative one?

How does java know whether a number is positive or negative?

How many bits are in a long?

How many numbers would you see in a hex string for that number of bits?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How would you approach this question...