compile error when run my java code in cmd

0 edward sutta · February 9, 2015
hey i'm getting error and my compiler code are down here.............please help!

C:\test>javac youtube.java
youtube.java:2: error: cannot find symbol
        public static void main(string args[]){
                                ^
  symbol:   class string
  location: class apples
youtube.java:3: error: package system does not exist
                system.out.println("hellow world!");
                      ^
2 errors

Post a Reply

Replies

Oldest  Newest  Rating
0 edward sutta · February 10, 2015
 it work better  .................:) thanks Nicholas  Capital  letters real matter in Java.
0 Nicholas Eason · February 9, 2015
system.out.println("hellow world!");

needs to be 

System.out.println("hello world!");

This: 
public static void main(string args[])

needs to be this:
public static void main(String args[])



Capital letters matter in Java.



It seems to be in your best interest to learn how to deal with errors presented by cmd ;)

So right after your execution line (javac youtube.java), it's always going to be presented in the same format.

fileName.java:Line number of error: error

 In your case, it was cannot find Symbol (for the first one).
The arrow just points to the line. You should look at where it says symbol. It tells you what symbol is incorrect.
class string. This means it can't find the class named string. Probably because it doesn't exist. You see this, and think, "oh, that should be a capital 'S'!".

As for the second one. Same format for the error.
fileName.java:line number of error: error


In this case, it was Package system does not exist. In this case, it pointed to the package, but in other cases it will just point to the line. Knowing now that it is System, and not system, you can see what your error was.
  • 1

Java / Android Development

107,308 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator