Home Tutorial Java Scjp Part1 SCJP Module-1 Question-15


Share on Google+Share on Google+
SCJP Module-1 Question-15
Posted on: July 8, 2010 at 12:00 AM
The given program checks your understanding of static methods and also function overloading concepts. And it is also very useful for SCJP examination.

Given a sample code:

public class Sample {

public static void outcome(short a) {
System.out.print("short ");

public static void outcome(Long a) {
System.out.print("LONG ");

public static void main(String[] args) {
short shortVar = 1;
long longVar = 109002;

What will happen when you compile and run the above give sample code?

1) Compile time error
2) Compile and print "short long"
3) Compile and output of null
4) Compiles but gives Runtime Exception




It will compile and run successfully there is no issue of using the static method here.


Related Tags for SCJP Module-1 Question-15:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 8, 2010

Recommend the tutorial

Advertisements Advertisements