[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Basic Concepts - Discussion

Home > JAVA Programming > Basic Concepts > MCQs Questions Discussion

50 / 64

Choose the correct option.

String valid = "true";
if(valid)
 System.out.println("valid");
else 
 System.out.println("not valid");

Avalid

Bnot valid

CCompilation fails

DAn illegal argument exception thrown at runtime

Answer: Option (Login/Signup)

Show Explanation

Hence, we get an error saying, incompatible types : String cannot be converted to Boolean.

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here