Consider the following program:
What is the result:
A. Program produces no output but terminates correctly.
B. Program does not terminate.
C. Prints out "Hello"
D. Prints out "Goodbye"
Select the most appropriate answer.
This code will not compile, and the suggested answer is C.
PS. I see this forum is not really used. If I don't get a reply I'll post in SCJP forum.
Pay special attention to statements like
if(a = true)
which is not the same as
if(a == true)
In the former, the condition will always be true since the boolean variable a is assigned true anf the whole expression evaluates to a's value, that is true.
Welcome to Javaranch
We'd like you to read the Javaranch Naming Policy and change your publicly displayed name (change it here) to comply with our unique rule. Thank you.
PS: Quote from the naming policy:
For your publicly displayed name, use a first name, a space, and a last name. Obviously fictitious names or improperly formatted names may be locked out.
[ September 19, 2002: Message edited by: Valentin Crettaz ]