public class Test{
public static void main(String[] args){
for(int i =0;i<=Integer.MAX_VALUE;i++){
System.out.println("i="+i);
}
}
}
What will this program do?
Answer: This will be an infinite loop, remember Integer.MAX_VALUE+1 is Interger.MIN_VAlUE (which is less than Integer.MAX_VALUE)
Pune-Google Technology User Group
Loading...
Saturday, December 8, 2007
Subscribe to:
Post Comments (Atom)
2 comments:
gives compile time error as min and max both are non static variable used in static method with out any object reference.
After getting rid of the errors it prints a HUGE list of numbers till it reaches 2147483647. Man sure filled my screen up.
Post a Comment