How to correct the error?
By rajeev
@rajeev075 (1961)
India
February 14, 2011 6:03am CST
Hello Friend!
I am New to java just start studying by myself.
I got the problem here.
Could you shout out this?
When i compile java i got the errors mention below
javac example.java
ex.java:2: cannot find symbol
symbol : class string
location :class example
public static void main(string args[]{
example.java:3: package system does not exist
system.out.println("My first java program")
2 errors
1 person likes this
1 response
@owlwings (43910)
• Cambridge, England
14 Feb 11
Have you created the class correctly? The name of a public class is spelled exactly as the name of the file and is case sensitive. If your file is named HelloWorld, the class must be created as "public class HelloWorld { ... &c". "public class helloworld { ..." would give an error.
@rajeev075 (1961)
• India
15 Feb 11
I had checked alot of time and references many time to the books and searches on internet still getting nothing.
Did have to include headers like we do in c/c++?
I had installed the java JDk kit from the oracle site. The version is jdk-6u23-windows-i586. I also had copied the file path of bin folder and made a environmental variable as path. Still not getting the result.
Can you suggest other way of compilation?
My program look as below (no additional other than written below)
class example {
public static void main (string args[]){
system.out.println("my first java program");
}
}
@mominshaik (11)
• India
30 May 11
As owlwings said above please check the Caps and double letters carefully.
In the code mentioned by you, please Give like below and try to compile it.
System.out.println("my first java program");