+ 2
output of this code?
public class TestProgram { public static void main(String[] args) { String tie = null; while ( tie = null ){ tie = "you are from mars"; System.out.print(tie); } }}
2 Answers
+ 4
I think it will give compile time error because condition should be a Boolean expression in Java.
+ 6
Yep as @Nikhil says , you are using the assignment operator ( = ) when you should be using ==
So it will give you the output you want if you do (tie == null )