I'm starting to learn java and have created my first hello world function in Eclipse. I've noticed that the following two functions, both in the default package of the src folder in my java project, seem to do the same thing:
class HelloWorld {
public static void main(String[] args){
System.out.println("Hello World!");
}
}
and
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello World!");
}
}
Both successfully print 'Hello World!' to the console.
I've read a bit about different class types, but am unsure what type of class I would be declaring with the first function. What's the difference between these two functions? Does java make my hello world class in the first case public?