java:exceptions_intro

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
java:exceptions_intro [2017/03/10 11:15]
gthanos
java:exceptions_intro [2018/03/12 07:50]
gthanos
Line 18: Line 18:
    
    public static void main (String[] args) {    public static void main (String[] args) {
-      int x; +      int x, y
-      int y; +      while(true) { 
-      int result; +          int result; 
-      Scanner input = new Scanner(System.in);+          Scanner input = new Scanner(System.in);
  
-      System.out.print( "Enter first integer: " ); +          System.out.print( "Enter first integer: " ); 
-      x = input.nextInt();+          x = input.nextInt();
  
-      System.out.print( "Enter second integer: " ); +          System.out.print( "Enter second integer: " ); 
-      y = input.nextInt(); +          y = input.nextInt(); 
-       +           
-      result = x/y; +          result = x/y; 
-       +           
-      System.out.printf( "Product is %d\n", result );+          System.out.printf( "Product is %d\n", result ); 
 +      }
    }    }
 } }
java/exceptions_intro.txt · Last modified: 2021/03/23 07:23 by gthanos