UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the use of the "this" keyword in Java?

Asked by Last Modified  

9 Answers

Learn Java

Follow 6
Answer

Please enter your answer

'this' refer the current instance of a class. You can get and set data members of current object using 'this' prefix inside there class data type.
Comments

Private Online Java Training by Exp Software Engineer

The 'this' keyword in Java is a reference variable that refers to the current class object. 'this' keyword can be used to refer current class instance variable 'this' can be used to invoke or initiate current class constructor It can be used to return the current class instance 'this' can be passed as...
read more
The 'this' keyword in Java is a reference variable that refers to the current class object. 'this' keyword can be used to refer current class instance variable 'this' can be used to invoke or initiate current class constructor It can be used to return the current class instance 'this' can be passed as an argument in the method call 'this' can be passed as argument in the constructor call read less
Comments

Java Tutor

class xyz{ int x; int y; xyz (int x,int y){ this.x=x; this.y=y; } Used to specify current class object
Comments

Programmer

"This" is a keyword it refers to the current object E.g if your method variable name is same as your reference variable name then we use "this" keyword to tell the compiler that i am using reference variable not method variable For Core Java Training You can visit and Send a Enquiry on my Profile...
read more
"This" is a keyword it refers to the current object E.g if your method variable name is same as your reference variable name then we use "this" keyword to tell the compiler that i am using reference variable not method variable For Core Java Training You can visit and Send a Enquiry on my Profile on UrbanPro http://ubpro.in/C67fasiy Vivek read less
Comments

In java 'this ' keyword is used to access property of current class eg. using 'this' keyword current iinstance variable of class is accessible.
Comments

Web Engineer

this can be used to refer current class instance variable. this can be used to invoke current class method (implicitly) this() can be used to invoke current class constructor. this can be passed as an argument in the method call. this can be passed as argument in the constructor call. this can be used...
read more
this can be used to refer current class instance variable. this can be used to invoke current class method (implicitly) this() can be used to invoke current class constructor. this can be passed as an argument in the method call. this can be passed as argument in the constructor call. this can be used to return the current class instance from the method. read less
Comments

Keyword 'THIS' in Java is a reference variable that refers to the current object. It can be used to refer current class instance variable.
Comments

Java Professional

actually "this" keyword resolve the ambiguity between the current instance variable and the constructor parameter, also keeping both the parameters with same name is not a good practice anymore as well. So better way is to make your constructor parameter with name starting with "p" where "p" stands for...
read more
actually "this" keyword resolve the ambiguity between the current instance variable and the constructor parameter, also keeping both the parameters with same name is not a good practice anymore as well. So better way is to make your constructor parameter with name starting with "p" where "p" stands for parameter. In that case your code will run with out "this" as well. read less
Comments

Tutor

"this" is a refernce variable that refers to the current object. "this" keyword is used to refer current class instance variable in a conctructor and a method which has called the method.
Comments

View 7 more Answers

Related Questions

What is Constructor in Java?
1. Constructor is just like a method ( referred as special method as it appearance look like normal methods) 2. It's name is same as class name 3. It doesn't return any value 4. It is invoked/called...
Ujwalajagdale
0 0
8
Is synchronized keyword necessary, in Java, if everything that is modified in a function is local to that function?
No, it is not required if you make sure whatever parameters are updated/modified will be done as atomic references/operations. Atomicity is an alternative to syncronizatiom.
Abishiek
0 0
6
What are the advanced Java topics?
Mainly divided in three parts JDBC,SERVLET,JSP and each one contains multiple sub topics
Ganesh
0 0
5
What are the requirements of learning Java? How long it takes to learn java and what is the fee structure?
Core java is main to learn, if you join my classes it takes one month to become master.
Ruuchi

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Java Advantages
In this video, learn about Java and its advantages. Also, check out the difference between Java and C++, Java development kit, Java Run Time Environment (JRE) with a proper demonstration program for better clarity.

Finding a Majority Element
Problem Description Task. The goal in this code problem is to check whether an input sequence contains a majority element. Input Format. The first line contains an integer, the next one contains a sequence...

Differences Between HashMap vs HashSet In Java.
HashSet HashMap HashSet implements Set interface. HashMap implements Map interface. HashSet stores the data as objects. HashMap stores the data as key-value pairs. HashSet...

Mastering in Java Programming
Core java topics What is Java?Execution Model Of JavaBytecodeHow to Get Java?A First Java ProgramCompiling and Interpreting ApplicationsThe JDK Directory StructureUsing Eclipse Data types and Variables What...

How to create Rest web services in Java
Web services are web application components that lets two different applications to communicate over the network.Let if an application which in written java provides web services can be communicated through...

Recommended Articles

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more