1 import java.io.*; 2 public class BranchTests { 3 4 public static void main (String [] args) { 5 BranchTests bt = new BranchTests(); 6 bt.runContinues(); 7 bt.runBreaks(); 8 } 9 10 public void runBreaks() { 11 try { 12 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 13 StringBuffer word = new StringBuffer (); 14 while (true) { 15 String in = (String )br.readLine(); 16 if (in.equals( "done")) break; 17 word.append(in); 18 } 19 System.out.println(word); 20 21 int i = 0; 22 outer: while(i < 5){ 23 int j = 0; 24 inner: while (j < 3) { 25 String in = (String )br.readLine(); 26 if (in.equals("outer")) break outer; 27 if (in.equals("inner")) break inner; 28 System.out.println(j); 29 j++; 30 } 31 System.out.println(i); 32 i++; 33 34 } 35 36 37 } 38 catch (IOException e) { 39 System.out.println(e.getMessage()); 40 } 41 42 43 } 44 45 public void runContinues() { 46 47 } 48 } 49 | Popular Tags |