2 Creating a Simple Java Program
Exam objectives covered in this chapter |
What you need to know |
[2.1] Create executable Java applications with a main method. |
The right method signature for the main method to create an executable Java application. The arguments that are passed to the main method. |
[2.2] Compile and run a Java program from the command line. [2.3] Import other Java packages to make them accessible in your code. |
Compiling and executing a Java program using javac and java tools. Understand packages and import statements. Get the right syntax and semantics to import classes and interfaces from packages in your own classes. |
In the OCP Java SE 11 Programmer I exam, you’ll be asked questions on the executable Java applications and its requirements, packages, importing classes. Given that information, this chapter will cover the following:
- Understanding executable Java applications
- Command line – code compilation and execution
- Java packages
2.1 Executable Java applications
|
[2.1] Create executable Java applications with a main method |
Doesn’t the Java Virtual Machine execute all the Java classes when they are used? If so, what is a nonexecutable Java class? Let’s uncover the details in this section.