Getting an error on hello world.

0 Andrew Richardson · May 19, 2015
Code won't run when I put this in:
class apples{
    public static void main(String args[]){
        System.out.println("Hello World");
    }
}
 
Following error appears:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at apples.apples.main(apples.java:2)

I am using JDK 8





Post a Reply

Replies

Oldest  Newest  Rating
0 Nicholas Eason · May 19, 2015
You need to declare the class public. You left the access modifier blank.

Change it to:

public class apples{

}
  • 1

Java / Android Development

107,159 followers
About

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

Links
Moderators
Bucky Roberts Administrator