Language BasicsCreate your first Java programLet's start by compiling and running the following short sample program.
________________
/*
This is a simple Java program. Call this file "progname.java".
*/public class progname {
// Your program begins with a call to main(). public static void main(String args[]) {
System.out.println(
"Java.");
}
}
- Code:
-
/*
This is a simple Java program. Call this file "progname.java".
*/
public class progname {
// Your program begins with a call to main().
public static void main(String args[]) {
System.out.println("Java.");
}
}
In Java, a source file is called a compilation unit. It is a text file that contains one or more class definitions. The Java compiler requires that a source file use the .java filename extension.
In Java, all code must reside inside a class. By convention, the name of the public class should match the its file name. And Java is case-sensitive.