Java Dot Operator

In Java, operators are special symbols (such as +, -, *, /, &, ||, &&, ^, !, =, etc.) that perform specific operations on one, two, or more than two operands, and then return a result. Except for these operators, Java provides some other operators such as instanceOf operator, dot operator, scope resolution operator, etc. In this section, we will discuss only the dot operator in Java, its uses with example.

It is just a syntactic element. It denotes the separation of class from a package, separation of method from the class, and separation of a variable from a reference variable. It is also known as separator or period or member operator.

  • It is used to separate a variable and method from a reference variable.
  • It is also used to access classes and sub-packages from a package.
  • It is also used to access the member of a package or a class.

In simple words, we can say that the dot operator is actually access provider of objects and classes. For example:

Example:

DotOperatorExample1.java

Output:

67

DotOperatorExample2.java

Output:

Minimum Value = 6754