Google for "Java boolean literals"
Probably best to go to the SCJP forum and see what sort of questions they are asking there.
Vishal Hegde wrote:Thank you . . . ,i had one more query how will i cum to know whether i am prepared for SCJP6 exams..??
Campbell Ritchie wrote:Somebody earlier said "true" for that. As stated, it won't work in Java, but it will be interpreted as false in C/C++.
Irmin Okic wrote:x=0 assigns the value 0 to the variable x
You got wrong this time, Campbell. In C/C++, the assignment operation always results into "true".
int x = 1; returns 1 where we don't care about it during normal intialization.
Let's get back to java. JVM has only numeric datatypes, but the compiler knows of booleans too; hence booleans are strictly required where a condition is to be evaluated.
fred rosenberger wrote:Are you sure? I thought that the expression "A = 0" would be evaluated to be 0, which would be false...
Sagar Rohankar wrote:You got wrong this time, Campbell. In C/C++, the assignment operation always results into "true".
ohh wait there, I think I was wrong, the example I checked on my VSC++ 6, is like this,
And as Himanshu said, in C/C++, value other than "0" is considered as true !!
Sorry for my wrong info and the little knowledge !!