java how to use the scanner

1. The code is as follows

Import java.util.Scanner; 

public  class Demo {
     public  static  void main (String [] args) {
         // Scanner scanner means, a user can obtain input 
        Scanner Scanner = new new Scanner (the System.in); 
        the System.out. println ( "Please enter the string:" );
         // define a variable that allows you to enter the a 
        int a = scanner.nextInt ();
         int b = scanner.nextInt (); 
        System.out.println ( "two variables phase × result is: " ); 
        System.out.println (a +" * "+ B +" = "+ a * B); 
        
    } 
}

2. The final results were as follows (int system waits two input variables and to take your calc)

 

Guess you like

Origin www.cnblogs.com/yaoliuyang/p/12516738.html