/** * This is a recommended Polystyle Java example. * Reformat this file as you like to define your personal style. * * Notes: * 1.) Polystyle does not format comments based on examples. It will always * format comments the same way. * * 2.) Some constructs (such as 'for' statements) have only some of their * possible formatting combinations defined in this file. Polystyle * will infer the formatting for these cases on the fly. If this is not * sufficient, simply add your custom code samples here. * * Copyright 2001-2003 Flashbulb Studios. * * http://Polystyle.com */ package pkg.pkg.pkg; import java.lang.ref.*; import java.util.*; import java.io.*; abstract public final class Example extends Sclass implements Int1, Int2, Int3 { public Example(int a, int b, int [] c) throws Ex1, Ex2, Ex3 { // if statements with empty braces if (x) { } else if (x) { } else { } // if statements with exactly one braced statement if (x) { a(); } else if (x) { b(); } else { c(); } // if statements with a single implicit substatement if (x) a(); else if (x) b(); else c(); // if statements with multiple statements if (!z) { j = ++i & (i); z = j[0][0][0]; } else if (a instanceof Class) { a(); return method(new String[] {a, b, c}, B.class, 'c'); } else { a(); return new Handler() { public final void method() [][][] throws E1 { new Object().field.method(); } }; } // while statements with a single implicit substatement while (x) a(); // while with multiple statements while (k == j) { label: h[0] = a ? b : ((int)c).d; break; } // for statements with a single braced statement for (int [] i = { 1, 2, 3 }; i > 6; i++) { break label; } // do statements with a single braced substatement do { continue label; } while (false); // local blocks { a(); } /* Synchronized and switch blocks: * * You can have case substatements be aligned by giving an example like: * * case 1: a(); * * b(); * * c(); * * etc... */ synchronized (this) { switch (c) { case 1: case 2: case 3: a(); b(); c(); case 4: break; // case with exactly one substatement default: break; } } } public void emptyMethod() { } public void method() { // try-catch-finally with empty bodies try { } catch (Throwable e) { } finally { } // try-catch-finally with exactly one statement try { a(); } catch (Throwable t) { a(); } finally { a(); } // try-catch-finally with multiple statements try { for (;;) { } // for statement with empty control statements a(); } catch (Throwable e) { do { } while (x); throw e; } finally { int i = i * 3, j, k; return i + "0"; } } } private class Class2 { static { i >> 1; } // array with multiple elements protected boolean bools1 [][][] = { false, false, false }; // array with a single element boolean bools2 [] = { false }; // array with no elements boolean bools3 [] = { }; // multidimensional array private final int [][][] array = new int[1][][][] { { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, }; abstract Object method1() throws Nothing; } protected interface Intf extends Super, Super2 { final int i = j || k; }