Tuesday, July 14, 2009

I just want someone help me out to run a simple java program. Before giving the answer please read details.?

I made a simple Java program in NOTEPAD with the name Example.java and saved it in the following path C:\Java\Jdk1.5.0_13\bin\example.java. The coding is:- class example{


public static void main(string args[]){


system.out.println("this is my first program");}


}


I have downloaded the Java Developer Kit Jdk1.5.0_13 from the sunmicrosystems' website as one of my friend specified. In order to compile the program, I opened MS-DOS and went to the bin folder and type as followa:- C:\Java\Jdk1.5.0_13\bin%26gt;javac example.java and hit the ENTER Key. It displayed some error. The output was :-


example.java:2: cannot find symbol


symbol: class string


location: class example


public static void main(string args[])


example.java:4: package system does not exist


system.out.println("this is my first program");


2 errors





Please help me out to run this program.

I just want someone help me out to run a simple java program. Before giving the answer please read details.?
Java is a case-sensitive language. That means that upper-case letters are not the same as lower-case letters.





In your case, String and System have both got to have a capital S for the program to work.





Hope this helps!
Reply:class Example


{


public static void main(String args[])


{


System.out.println("this is my first program");


}


}
Reply:You just made a few mistakes. System has a capital 's'. Secondly you named you file with a capital 'e' so it should be javac Example.java string should also have a capital 's'


No comments:

Post a Comment