Skip to content

Instantly share code, notes, and snippets.

@icco
Created January 8, 2010 07:18
Show Gist options
  • Save icco/271905 to your computer and use it in GitHub Desktop.
Save icco/271905 to your computer and use it in GitHub Desktop.
Interesting Java Problems
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);
}
}
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