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 error: cannot find symbol
        public static void main(string args[]){
  symbol:   class string
  location: class apples error: package system does not exist
                system.out.println("hellow world!");
2 errors

Post a Reply


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!");

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, it's always going to be presented in the same format. 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. 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


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

Bucky Roberts Administrator