answersLogoWhite

0

What does this keyword do?

Updated: 8/11/2023
User Avatar

Wiki User

7y ago

Best Answer

The term keywords in Search Engine Optimization (SEO) refers to the most important words or group of words in your website content. Keywords play an essential role in the SEO process because search crawlers use them to index your website. Thus, it is essential you understand how to leverage your website keywords for your SEO process to be a success.

The "this" keyword is simply a reference to the current object. If, for example, you wanted to add the object you're currently working in to a collection you would want to do something like:

// Collection c;

c.add(this); ---------------------------------------------------

actually,there are 3 uses of 'this' keyword: 1. to refer to the address of the object under consideration. 2. to avoid name space collision. 3. to call a constructor within another constructor.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

The "this" keyword refers to the current instance of the current object the code is running in. Code running in a "static" context has no "this", as there is no instance of the object to refer to. For example, if you are processing a paint event, "this" will refer to the component that is currently being redrawn.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The this keyword is used to provide a reference to the current object within its class. The most common use is to clarify scope issues with local variables which have the same identifier as a class member.

Example:

class MyClass {

int myVariable = 10;

void f() {

// This myVariable has a different value than the class member

int myVariable = 50;

// When we try to print it out, Java will display 50, since it looks to the local

// variables first

System.out.println(myVariable);

// If we wanted to specify that we should use the class member, we

// can use this.myVariable to reference it. Java will print out 10 this time.

System.out.println(this.myVariable);

}

}

note : using this means I'm calling my self. think like this ang go on !!

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

this keyword is used in java for insilization of class variable

example

class javademo

{

int id;

string name;

string address;

public javademo(int id, string name, strint address)

{

this.id = id;

this.name = name;

this.addesss = address;

}

}

manoj sharma

NIIT jawahar nagar varanasi

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

To understand the "new" keyword, you must first understand a few other concepts of Object-Oriented Programming (OOP). First, you need to know about classes, which are a template for a model of data; in a video game, for example, a class might be a player, an enemy, or a room's layout. Secondly, you should know about a constructor, which allows a class to set values for the data contained in the class. Given these two pieces of information, the new keyword is a function assigns an area of unused memory for the instance to reside, then calls the constructor for that class, which will set all of the values of the instance.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

The this keyword refers to the current instance of the object and can only be used in non-static member methods (it is passed to the function through a hidden reference parameter). Given that most member methods only operate upon the current instance, it would be tedious to access that instance's members explicitly, thus the current instance is always implied unless a member needs to be accessed through an explicit instance (such as an instance that was passed to the function via separate argument). The thiskeyword is typically only used when we need to pass the current instance to a static member function or to a non-member function, or to return a reference to the current instance from a non-static member function. It is not necessary to pass the current instance between non-static member functions given that it is already passed implicitly through the hidden this parameter.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Memory allocation.

The new keyword will create an object, and return a reference to the object.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Using this keyword in Java is a way of referencing something which has been used earlier in the program. This is very useful knowledge to have when the program is long.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does this keyword do?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is check a keyword in java?

No, 'check' is not a keyword in java language.


What is the use of keyword new used in AWT programming?

what is the use of new keyword in awt programming


Is super keyword is analogous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use


What is a keyword to division?

per


What is fuzzy keyword?

yes

Related questions

What is library keyword?

What is library keyword?


What is the keyword for ruby redfort catch your death?

The keyword is Marie Antoinette


How do you find the keyword of a specific book?

give me a keyword


How can you check keyword density?

There are many online tools are available for checking keyword density. I have mention some tools which are given below:- seobook.com/general/keyword-density/ smallseotools.com googletheplanet.com seoquake.com/ You can check keyword density by using these tools. I had checked my site (Royzez) keyword from seoquake and smallseotools.


Is check a keyword in java?

No, 'check' is not a keyword in java language.


Where can one get more details about the keyword?

"This is dependent on what keyword you are looking for. If you are looking for a keyword in a document you can type ctrl f to search for a keyword, or if it is for a secret club, you might need to join to find out."


What is the keyword that sums up to Skills and Experience?

Skills and Experience Keyword


Is in is used as a keyword in C language?

Neither "in" nor "is" is a keyword in C.


What is java's keyword for the integer data type?

"int" is the keyword for integer


Is float is a keyword in java?

yes, float is keyword and data type in java


What command is equivalent to the man -k keyword command?

apropos keyword


What is argument in actionscript?

An argument is a term that refers to keyword values in ActionScript. The number following the keyword phrase in parenthesis is used to reference the frame the keyword reaches prior to acting. It includes a user defined value for the preset keyword.