SE450: Example: Hello World - in a package [29/41] ![]() ![]() ![]() |
Java uses packages to group classes logically. All classes are in a package. If you don't specify a package, a class is in the default package, and the class has default visibility (it's almost like the class has public visiblility, but it is called package visibility).
The example with a package
// Filename: Hello.java package example; /** * A Java application that prints the message: "Hello from Venus!" */ public class Hello { public static void main (String[] args) { System.out.println("Hello from Venus!"); /* System.out refers to the standard output */ } }