Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2016 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5bf35d2599ef7f19c7fe to your computer and use it in GitHub Desktop.
Save anonymous/5bf35d2599ef7f19c7fe to your computer and use it in GitHub Desktop.
OCAJP8 Study Guide
package $;
public class _0experiment {
public static void main(String... $) {
System.out.println("---Order of operation & numeric promotion---");
int y = 4;
double x = 3 + 2 * --y;
int z = x > 8 ? y > 3 ? 2 : 7 : 0;
System.out.println("y=" + y + ", x=" + x + ", z=" + z);
System.out.println("---Boring switch---");
switch (z) {
case 7: System.out.println("Case 7");
default: System.out.println(("Default case: " + z * 2) + 12 / 2);
case 10:
System.out.println("Case 10"); break;
case 11:
System.out.println("Never more");
}
System.out.println("---Good luck---");
int[][] matrix = new int[][]{{2,3,4},{5,6,7},{8,9,1}};
/*/* Google all the things at */ http://google.com/ */
for (int i = 0; i < matrix.length; i++) {
for (int item : matrix[i]) {
if (++item > 0 & item % y == 0) {
System.out.print(item-- + " "); continue http;
}
System.out.println();
}
}
System.out.println("\n\nOh yeah!");
System.out.println("( ͡° ͜ʖ ͡°)");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment