/*What declaration turns this loop into infinitive loop.*/
public class Looper {
public static void main(String[] args) {
// Place your declaration for i here
while (i == i + 1) {
}
}
}
Solution:
// Place your declaration for i here
double i = 1.0/0.0
Let us share our views in java. Not only java, we can also share examples and configurations on Spring, Hibernate, javascript, CSS and Sqlserver queries. This blog will help you in giving the complete information and resolving your complete java related problems like the problems in core java, servlets, jsp spring, hibernate. And also the web technologies which includes all css related problems(Web 2.0).and java script and the latest smart jquery java script frame work
Showing posts with label How to solve java puzzles?. Show all posts
Showing posts with label How to solve java puzzles?. Show all posts
Jul 21, 2009
Solution for java puzzles(2)!
/*Provide declarations for the variables x and i such that*/
public class Tweedledum {
public static void main(String[] args) {
// Put your declarations for x and i here
x += i; // Must be LEGAL
x = x + i; // Must be ILLEGAL
}
}
solution:
// Put your declarations for x and i here
int x=0;
byte i;
public class Tweedledum {
public static void main(String[] args) {
// Put your declarations for x and i here
x += i; // Must be LEGAL
x = x + i; // Must be ILLEGAL
}
}
solution:
// Put your declarations for x and i here
int x=0;
byte i;
Subscribe to:
Posts (Atom)