Chapter 1. Java basics

 

This chapter covers:

  • [1.2] Define the structure of a Java class. Structure of a Java class, with its components: package and import statements, class declarations, comments, variables, and methods. Difference between the components of a Java class and that of a Java source code file.
  • [1.3] Create executable Java applications with a main method; run a Java program from the command line; including console output. The right method signature for the main method to create an executable Java application. The arguments that are passed to the main method.
  • [1.4] Import other Java packages to make them accessible in your code. Understand packages and import statements. Get the right syntax and semantics to import classes from packages and interfaces in your own classes.
  • [6.4] Apply access modifiers. Application of access modifiers (public, protected, default, and private) to a class and its members. Determine the accessibility of code with these modifiers.
  • [7.5] Use abstract classes and interfaces. The implication of defining classes, interfaces, and methods as abstract entities.
  • [6.2] Apply the static keyword to methods and fields. The implication of defining fields and methods as static members.
  • [1.5] Compare and contrast the features and components of Java such as: platform independence, object orientation, encapsulation, etc. The features and components that are relevant or irrelevant to Java.

1.1. The structures of a Java class and a source code file

1.1.1. Structure of a Java class

1.1.2. Structure and components of a Java source code file

1.2. Executable Java applications

1.2.1. Executable Java classes versus non-executable Java classes

1.2.2. The main method

1.2.3. Run a Java program from the command line

1.3. Java packages

1.3.1. The need for packages

1.3.2. Defining classes in a package using the package statement

1.3.3. Using simple names with import statements

1.3.4. Using packaged classes without using the import statement

1.3.5. Importing a single member versus all members of a package

1.3.6. The import statement doesn’t import the whole package tree

1.3.7. Importing classes from the default package

1.3.8. Static imports

1.4. Java access modifiers

1.4.1. Access modifiers

1.4.2. Public access modifier

1.4.3. Protected access modifier

1.4.4. Default access (package access)

1.4.5. private access modifier

1.4.6. Access modifiers and Java entities

1.5. Nonaccess modifiers

1.5.1. abstract modifier

1.5.2. final modifier

1.5.3. static modifier

1.6. Features and components of Java

1.6.1. Valid features and components of Java

1.6.2. Irrelevant features and components of Java

sitemap