The following code snippet depicts the anatomy of simple Java program.

The following code snippet depicts the anatomy of simple Java program.

The following code snippet depicts the anatomy of simple Java program.
Package

Package - Represents logical grouping of similar types into namespaces. It also prevents naming collision and provides access protection.

Import

Import - Imports the package, so that classes can be used in the code by their unqualified names.


Class

Class - Represents a type template having properties and methods.


Field

Field - Represents a member used for holding values.


Method

Method - Represents an operation/behaviour of the class.


Modifier

Modifier - Specifies access control level of a class and its members. Parameter - Specifies the variable declared in the method definition. Argument - Specifies the data passed to the method parameters.



Questions

What is package?
Why do you need to import packages?
Why do you need to specify access modifiers? What is static import?
static import enables access to static members of a class without need to qualify
it by the class name.
What is the difference between argument and parameter?

Next Topics:


1 . Java Program Anatomy
2 . Java program compilation and execution steps
3 . Java Data Types
4 . Java Object class

Our Trainings

Msk technologies