Dot Operator in Java - Google Search
Dot Operator in Java - Google Search
Listen
The dot operator (.) in Java is a binary operator that is used to access the
fields and methods of an object. It is also known as the member access
operator. The dot operator is used to separate the name of an object from the
name of a field or method. For example, the following code accesses the
name field of the person object:
Java
The dot operator can also be used to call a method on an object. For example,
the following code calls the greet() method on the person object:
Java
person.greet();
The dot operator can also be used to access static fields and methods. Static
fields and methods are fields and methods that belong to a class, rather than
an object. For example, the following code accesses the PI field of the Math
class:
Java
double pi = Math.PI;
https://www.google.com/search?q=dot+operator+in+java&oq=Dot+op&gs_lcrp=EgZjaHJvbWUq… 1/6
4/22/24, 8:36 PM dot operator in java - Google Search
The dot operator can also be used to call static methods. For example, the
AI Answer
following code calls the sqrt() method of the Math class:
Java
The dot operator is a very important operator in Java. It is used to access the
fields and methods of objects, as well as static fields and methods.
Why is dot used in System.out.println in Java? What is the double dot in Java? Dot ope
Ask a follow up
O'Reilly Media
https://www.oreilly.com › library › view › net-for-java
Ask a follow up
Feedback
https://www.google.com/search?q=dot+operator+in+java&oq=Dot+op&gs_lcrp=EgZjaHJvbWUq… 2/6