You are not logged in.

#1 2015-06-10 09:45:05

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

Class Test:

Question:
class Test
{

public static void main(String [] args)
{
StringBuffer a = new StringBuffer("M");
StringBuffer b = new StringBuffer("N");
mergeData(a, b);
System.out.println(a+","+b);
}

static void mergeData(StringBuffer x,StringBuffer y)
{
x.append(y);
y = x;
}

}
What would be the output?

Option A):
N,N
Option B):
MN,N
Option C):
M,M
Option D):
M,N

Correct Answer is Option B):
MN,N


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

2015-06-10 09:45:05

Advertisement
Ads By Google

Re: Class Test:



Board footer