public class TestStudent {
public static void main(String[] args) {
String valid = "true";
if (valid)
System.out.println("valid");
else
System.out.println("not valid");
}
}
What is the
result?
A.
Valid
Valid
B.
not valid
not valid
C.
Compilation fails
Compilation fails
D.
An IllegalArgumentException is thrown at run time
An IllegalArgumentException is thrown at run time
Risposta C. Non viene fatto alcuna cast automatico tra stringa e booleano.
Nessun commento:
Posta un commento