You are not logged in.

#1 2015-06-10 09:40:06

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

Java Constructor:

Directions:
Java Constructor

class Nest
{

Nest()
{
System.out.print("Nest");
}

Nest (long l)
{
this();
System.out.print(l);
}

Nest(int i)
{
this(i);
System.out.print(i*2);
}

}


Public static void main(String[] args)
{
int i = 4;
new Nest(i);
}

Question:
What would be the output?

Option A):
Nest44
Option B):
Nest84
Option C):
Nest48
Option D):
Compile Error

Correct Answer is Option D):
Compile Error


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

2015-06-10 09:40:06

Advertisement
Ads By Google

Re: Java Constructor:



Board footer