Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (45k points)

A) Passing itself to another method

B) Calling another constructor in constructor chaining

C) Referring to the instance variable when local variable has the same name

D) Passing itself to method of the same class

E) None of these

3 Answers

0 votes
by (99k points)

The correct answer to the question “What is not the use of 'this' keyword in Java” is, option (d). Passing itself to the method of the same class. This is one of the most important keywords in Java and is used to distinguish between local variables and variables that are passed in the methods as parameters. Wishing to learn Java and enhancing job opportunities? Check out the Java certification course from Intellipaat. Also, watch the following video on What is Java to get a better insight.

0 votes
by (140 points)

Referring to the instance variable when local variable has the same name

0 votes
by (1.3k points)
Correct option is D) Passing itself to method of the same class.

This keyword, refer the present instance of a class. Talking about which it is used for the following purposes:

Passing itself to another method Option A

Calling another constructor by constructor chaining.

Refer to an instance variable when a local variable of the same name exists:

However, passing this into a method in the same class (Option D) wouldn't be needed, because you can access an instance from the same class without such overhead.

Related questions

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...