0% found this document useful (0 votes)
50 views

Dot Operator in Java - Google Search

The dot operator (.) in Java is used to access fields and methods of objects and call methods. It separates the object name from the field or method being accessed. For example, person.name accesses the name field of a Person object and person.greet() calls the greet() method on a person object.

Uploaded by

ishwar khalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Dot Operator in Java - Google Search

The dot operator (.) in Java is used to access fields and methods of objects and call methods. It separates the object name from the field or method being accessed. For example, person.name accesses the name field of a Person object and person.greet() calls the greet() method on a person object.

Uploaded by

ishwar khalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/22/24, 8:36 PM dot operator in java - Google Search

dot operator in java AI Answer

All Images Videos Shopping News More Tools

With example W3schools Triple In Hindi

About 2,18,00,000 results (0.37 seconds)

Generative AI is experimental. Learn more

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

Person person = new Person();


String name = person.name;

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

double squareRoot = Math.sqrt(4);

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

The member access (dot) operator (“.”) is used frequently to access a


field or to call a method on an object. object a = new object(); a.
ToString(); The dot operator is also used to form qualified names: names
that specify the namespace or interface (for example) to which they
belong.

O'Reilly Media
https://www.oreilly.com › library › view › net-for-java

The Member Access (Dot) Operator - .NET for Java Developers


About featured snippets • Feedback

People also ask

What is the dot operator?

What is dot class in Java?

What is the dot notation method in Java?

What is the multiple dot operator in Java?

Ask a follow up

Feedback

https://www.google.com/search?q=dot+operator+in+java&oq=Dot+op&gs_lcrp=EgZjaHJvbWUq… 2/6

You might also like