lavanya sankuappan

Greenhorn
+ Follow
since Jun 02, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by lavanya sankuappan

Thanks Marc for your explanation
class test {
public static void main (String[] args) {
double d1 = Math.random();
boolean b1 = (d1 < 0.0), b2 = (d1 <= 0.0), b3 = (d1 == 0.0);
boolean b4 = (d1 >= 0.0), b5 = (d1 < 1.0), b6 = (d1 <= 1.0);
boolean b7 = (d1 == 1.0), b8 = (d1 >= 1.0), b9 = (d1 > 1.0);
}}

Which of the boolean variables will never be initialized to the value true?
i thought answer is b1,b2,b6,b7,b8,b9

but i am getting result as b1,b2,b3,b7,b8,b9.could someone explain how it is right for b3 and wrong for b6
class test {
public static void main (String[] args) {
int i = 0, j = 0, k = 0;
do
while (i++ < 3)
System.out.print(k++);
while (j++ < 3);
}
}
the above question has a while-loop nested inside a do-loop.
Thanks for that explanation keith
class test {
public static void main (String[] args) {
int i = 0, j = 0, k = 0;
do
while (i++ < 3)
System.out.print(k++);
while (j++ < 3);

}}
here inner while loop prints value of k as 0,1,2
this whole output should be repeated in outer do while loop until j++<3(four times)but how come result is only 012.sorry if i have misunderstood the concept
thanks for all your explanations
class test {
public static void main (String[] args) {
int i = 0, j = 0;
while (i++ < 3) do
System.out.print(j);
while (j++ < 3);
}}
how do you get the output 012345
i am sorry about that,i didn't leave space between arguments
class c {
public static void main(String[] args) {
int i = 0;
while (++i < args.length) {
System.out.print(args[i]);
}}}

when i run this program like java c abcdef,it doesn't show any output.why is it like that?
so,is the answer for the question 'b'?
sorry about that,actual code is

interface I
{
int i=1,ii=test.out("ii",2);
}

interface J extends I
{
int j=test.out("j",3),jj=test.out("jj",4);
}

interface K extends J
{
int k=test.out("k",5);
}


class test {
public static void main (String[] args)
{
System.out.println(J.i);
System.out.println(K.j);
}
static int out(String s,int i)
{
System.out.println(s +"=" +i);
return i;
}
}

output is
1
j=3
jj=4
3
interface I
{
int i=1,ii=trial2.out("ii",2);
}

interface J extends I
{
int j=trial2.out("j",3),jj=trial2.out("jj",4);
}

interface K extends J
{
int k=trial2.out("k",5);
}


class test {
public static void main (String[] args)
{
System.out.println(J.i);
System.out.println(K.j);
}
static int out(String s,int i)
{
System.out.println(s +"=" +i);
return i;
}
}

output is
1
j=3
jj=4
3
i understand reason for the first three lines of output.but how come 3 is displayed.please explain?
private method,method1() in parent class is not overridden by child class.it is another method with the same name
how come option c is wrong while e works fine?