Kaveri Rajesh

Greenhorn
+ Follow
since Nov 07, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Kaveri Rajesh

Hi,

Consider the following code:

for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
if(i==j) {
continue;
}
System.out.println(" i = " + i + " j = " + j);
}
}
Which lines would be part of output?
A. i = 0 j = 0
B. i = 0 j = 1
C. i = 0 j = 2
D. i = 1 j = 0
E. i = 1 j = 1
F. i = 1 j = 2
The answer given is B, C, D, F. Can anyone explain how continue statement executes?
Thanks
Kaveri
The following code will give
1: Byte b1 = new Byte("127");
2:
3: if(b1.toString() == b1.toString())
4: System.out.println("True");
5: else
6: System.out.println("False");
A) Compilation error, toString() is not avialable for Byte.
B) Prints "True".
C) Prints "False".

The answer given is C(prints false).
I think b is correct answer. Can anyone please guide?
Thanx Bill and Paul. It helped me a lot.
Given the following code what will be the output?
class ValHold{
public int i = 10;
}
public class ObParm{
public static void main(String argv[]){
ObParm o = new ObParm();
o.amethod();
}
public void amethod(){
int i = 99;
ValHold v = new ValHold();
v.i=30;
another(v,i);
System.out.println(v.i);
}//End of amethod
public void another(ValHold v, int i){
i=0;
v.i = 20;
ValHold vh = new ValHold();
v = vh;
System.out.println(v.i+ " "+i);
}//End of another
}
1) 10,0, 30
2) 20,0,30
3) 20,99,30
4) 10,0,20
The answer given is 10,0,20.
Can anybody please explain how this answer is correct?
Can anybody please tell me what is the difference between Daemon Threads and User Threads?