i get the error [B]undefined label: newHost[\B]
but not a similar error for label intError
Code:import java.io.*; import java.net.*; public class Client { public static void main (String args []) throws IOException { BufferedReader keyboard = new BufferedReader (new InputStreamReader (System.in)); [I]newHost:[\I] System.out.print ("connect to IP: "); String host = keyboard.readLine(); int port= 0; [I]intError: [\I]try { port = Math.abs (Integer.parseInt (keyboard.readLine())); } catch (NumberFormatException e) { System.out.println ("plz enter a valid port num"); break intError; } try {Socket connection = new Socket (host, port);} catch (UnknownHostException e){ System.out.println ("Host can not be found\n"); break newHost; } }//end main }//end Client





Reply With Quote