Created
January 8, 2010 07:18
-
-
Save icco/271905 to your computer and use it in GitHub Desktop.
Interesting Java Problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimalFarm { | |
public static void main(String[] args) { | |
final String pig = "length: 10"; | |
final String dog = "length: " + pig.length(); | |
System.out.println("Animals are equal: " + pig == dog); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Increment { | |
public static void main(String[] args) { | |
int j = 0; | |
for (int i = 0; i < 100; i++) { | |
j = j++; | |
} | |
System.out.println(j); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment