Java Features

Main Method in Java

The main method is the entry point to a desktop based core Java application.

Previously, we created our first Java program "" as:

public class Hello {

  public static void main(String[] args)





We then compiled it using javac as:


We then executed it as:

java Hello

And output was:


Import Statements in Java

To access a class or method from another package we need to either use the fully qualified name (e.g. com.javajee.MyClass) or we can use the import statements.


Using import statement

You can use an import statement to import a single class (import java.util.List;) or all classes of a package (import java.util.*;). Remember that you can import only types (classes and interfaces, but not methods) using a regular import.

Consider an example:

Packages in Java

Packages are used in Java for organizing your class files. It can be considered as different folders to organize your files within your file system. You can put related class files together in one package. Java groups predefined classes into different packages like java.lang, java.util, etc.

Wrapper classes, Auto-boxing and Auto-unboxing

Wrapper classes

The wrapper classes provide a mechanism to "wrap" primitive values in an object so that the primitives can be included in activities only for objects, like being added to Collections. There is a wrapper class for every primitive in Java. The wrapper class for int is Integer and the class for float is Float and so on. Wrapper classes also provide many utility functions for primitives like Integer.parseInt().

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within!!!