on 09-21-2006 8:18 AM
Hello i m a beginner in java .kindly help me in solving this question.
wat 'll happen when u compile and run this code
int Output=10;
boolean b1=false;
if((b1==true)&& ((Output+=10)==20)){
System.out.println("We r equal" + Output);
} else {
System.out.println("not equal" + output);
}
Options---
1.Compile error, attempting to perform binary comparison on logical data type
2.Compilation and output of "We r equal 10"
3.Compilation and output of "Not equal 20"
4.Compilation and output of "Not equal 10"
Hi
The Answer is
4.Compilation and output of "Not equal 10"
Because The else part will be executed insted of and condition the b1=false.
The + operator with the String always concatinate the String
and the variable
See this link
http://www.gginc.biz/jfront/index.html
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Payal,
I think it is not okay from you to let the forum guys answer all your exam question without approve by points.
Torsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.