Topics Index


If you need explanation Read this topic

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(Long.toHexString(0x100000000L + 0xcafebabe));

A. Enjoy
B. Enjoy
C. Enjoy
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


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