You are not logged in.

#1 2015-06-16 06:04:28

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Java Language Constructors-And-Methods Code:

Java Quizzes Java Language Constructors-And-Methods

Directions:
public class Test{
      public static void printValue(int i, int j, int k){
            System.out.println("int");
      }

      public static void printValue(byte...b){
            System.out.println("long");
      }

      public static void main(String... args){
            byte b = 9;
            printValue(b,b,b);
      }
}

Question:
What is the output for the below code?

Option A):
Compilation clean but throws RuntimeException
Option B):
long
Option C):
Compilation fails
Option D):
int 

Correct Answer is Option D):
int


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-16 06:04:28

Advertisement
Ads By Google

Re: Java Language Constructors-And-Methods Code:



\n

Board footer