Hi everybody,
I am new to java I installed netbeans 6.0.1
I tried running the following simple program but it didnor work???
import java.util.*;
public class Hello
{
public static void main(String [] args)
{
Scanner reader = new Scanner(System.in);
String name;
System.out.print("What is your name? ");
name = reader.readLine();
System.out.println(name + " I look forward to a long and fruitful relationship.");
}
}
I got the following error:
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\PAAET User\My Documents\NetBeansProjects\JavaApplication8\build\ classes
C:\Documents and Settings\PAAET User\My Documents\NetBeansProjects\JavaApplication8\src\ja vaapplication8\Main.java:28: class, interface, or enum expected
--------------------------------------------------------------------------------
1 error
BUILD FAILED (total time: 0 seconds)
解决方案Try using this code to read the name
name= scanner.next();
The class you have shown us is not the class that was compiled.
kind regards,
Jos
The class you have shown us is not the class that was compiled.
kind regards,
Jos
Thanks but how can I do it I just press the green triangle.