Menu
Topics Index
...
`

Threads1978


If you need explanation Read this topic

Threads1978
What will be the output of the following program?
public class Marshal {
    public static void main(String[] args) {
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                System.out.println("Enjoy");
                System.out.println(Long.toHexString(0x100000000L + 0xcafebabe));
            }
        });
        System.exit(0);
    }
}

A. Enjoy
100000000cafebabe
B. Enjoy
100000000
C. Enjoy
cafebabe
D. Some other output
E. Output can not be determined
F. Compilation Error or Runtime Error
Topic: Java Runtime Class - java.lang.Runtime

If you need explanation Read this topic

User comments below. All of them might not be correct.

ans.c 1st output prints enjoy.2nd prints cafebabe bcz tohexstring method returns string containing in the value of hex num formate

Posted by Maheshwari Natarajan    2014-05-19 05:34:02


C

Posted by Rajashekar Chelpuri    2014-05-19 07:56:56


Answer : F

Posted by Deepak Kumar Yadav    2014-05-19 10:57:19


Congratulations Maheshwari Natarajan. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-05-20 04:34:06


© meritcampus 2019

All Rights Reserved.

Open In App