Java Reference

Java Reference Home | Smart Soft Home

Period .
Generally, the period is used as separator.

Description 1

Used to access an instance variable. The period separates an object name from a variable name.

Example 1

r1.length = 10;

Description 2

Used to access a class variable. The period separates the class name from a variable name.

Example 2

Room.count = 10;

Description 3

Used to invoke an instance method. The period separates an object name from a method name.

Example 3

r1.print();

Description 4

Used to invoke a class method. The period separates the class name from a method name.

Example 4

int i = Integer.parseInt(s);

Description 5

Used to separate package names from each other and from class names. In the following code snippet, java and awt are package names and Frame is a class name.

Example 5

java.awt.Frame f1 = new java.awt.Frame("My Frame");