SCJP Certification

Sun Certified Java Programmer Certification exam essentials

November 16th, 2009

What will be the result while compiling and running the code?

Java Questions, by Daisy Williams.

import java.util.EnumSet;
public final class EnumMeg
{
public static void main(String[] args)
{
Integer i = null;
method(i);
}
static void method(int k){
System.out.println(k);
}
}

It will compile but will throw a NullPointerException at runtime.

Share

Back Top

Responses to “What will be the result while compiling and running the code?”

Comments (0) Trackbacks (0) Leave a comment Trackback url
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*