Home > Back-end >  Scanner problem in JAVA SE
Scanner problem in JAVA SE

Time:10-12

This is the program I wrote
import java.util.*;//load Java. Util class libraries all the classes
Public class InputNum
{public static void main (String [] args)
{int a=0;
Float b=0 f;
Double c=0 d;
System. Out. Println (" input from the keyboard an integer: ");
Scanner buf=new Scanner (System. In);
A=buf. Nextlnt ();//call nextInt () method, and read the number assigned to a
System. The out. Println (" you enter an integer is "+ a);
System. The out. Println (" input from the keyboard a single-precision floating-point number: ");
B=buf. NextFloat ();//call nextFloat () method, and read the number assigned to b
System. The out. Println (" you input single-precision floating-point number is "+ b);
System. The out. Println (" input from the keyboard a double-precision floating-point number: ");
C=buf. NextDouble ();//call nextDouble (), will read the number assigned to the c
System. The out. Println (" you input double-precision floating-point number is "+ c);
}
}
But every time will appear below the Javac situation

Ever bosses, help me to the novice to solve

CodePudding user response:

A=buf. Nextlnt ();//call nextInt () method, and read the number assigned to a

Is nextInt right, your input is nextlnt, capital letter I , and lowercase letter l , like very much,

CodePudding user response:

Thank you I have already corrected, but the situation is still not changed or the above case

CodePudding user response:

refer to the second floor joseph_wuxxx response:
thank you very much I have changed, but the situation is still not change or the above case


Recommend installing eclipse to learn Java, might not have these troubles, another key words spelling will also help you find,

CodePudding user response:

Suggest the building use coding tools, such as the idea, the command line many times for character encoding these have many differences

CodePudding user response:

Why people think may be you to write the input method of state, are written in English only, I suggest you turn input into English, try to write the source code, welcome to join the qq group (810264180) communication,

CodePudding user response:

Performed manually javac command, to set good claaspath environment variables, how to set the environment variable, lz Google baidu by oneself

CodePudding user response:

The
refer to the original poster joseph_wuxxx response:
this is the program I wrote
Have bosses for me this new solution, with


Estimated that you are using Java java9 version above, and with the TXT useless programming tool, so the import of Java. Util will fail, suggest to install a java8, or using the programming tool, at the same time, pay attention to the programming tools support Java version,
  • Related