Package com.day6.one;
Import Java.util.Scanner;
public class Demoscanner {
/**
* @param args
* 1. If the class name is the same as the existing class name, then it will be overwritten by others, some functions of the existing class can not be realized, such as the above Demoscanner class
* If the name is scanner, the class of the system will be overwritten
* 2. In general, the first letter of the class name, such as Primenumber, the method first letter lowercase such as getname ()
*/
public static void Main (string[] args) {
Scanner sc=new Scanner (system.in); Keyboard entry
int I=sc.nextint (); Keyboard input integer stored in I
System.out.println (i);
if (Sc.hasnextint ())///determines whether the input int value is true public boolean hasnextint () {
Return Hasnextint (Defaultradix);
}*/
{
int I=sc.nextint ();
System.out.println (i);
}
Else
System.out.println ("Wrong type of input");
}
}
Correct use of java-class names