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

Can finally block be used without try block?
No. But it can be used without a catch block.
Sarala
How can in prepare for competitive programming in Java ? Any person or Institute who Teaches ? HELP !
If you are already a java programmer and wanted to increase your logical skills and compete somebody then you have to practice writing various logics so that you will become strong in java programming....
Ajay
Do I need to import java.lang package any time? Why?
No, you don't need to import it at any time. As this is part of java.lang package is a part of \jdk1.6.0_11{this is the location f your jdk installation directory}\jre\lib\rt.jar and this rt.jar (called...
Anitha
Can a class have interface and vice-versa?
how its possible both has different meaning you cant enclosed it
Deepa
0 0
7

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

Ask a Question

Related Lessons

Why Should We Learn Java Language?
Most of starters has confusion today that which of the programming language should be chosen to work on. It totally depends upon your need. As per my opinion, if you want to grow your career in IT industry...

Java Learning Tip
The easy way to learn any programatical language is just simple practices. Take a simple examples and practice daily one hour. And also go through the learning videos from youtube or somewhere else.

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.

Introduction to Course Content
Video about what we are going to learn throughout the Java Training Session .

Create Immutable Class
Snippet of an Immutable Class: package com.stringhr; /*Declare the class as 'final'. This would prevent any other class from extending it and hence from overriding any method from it which could modify...

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