Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java try and catch

int midterm;
  System.out.printLn("Enter midterm grade");
  do
  { 
      try {
          string s = in.nextLine();
          midterm = Integer.parseInt(s);
          break;
      }
      catch (Exception e)
      {
          System.out.printLn("Couldn't parse input, please try again");
      }
  }
  while (true);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #catch
ADD COMMENT
Topic
Name
1+3 =