---
title: "How does \"this\" keyword work in OOPS?"  
description: "How does \"this\" keyword work in OOPS?"  
author: "samay srivastava"  
published: 2018-03-08  
updated: 2018-07-12  
canonical: https://answers.mindstick.com/qa/37395/how-does-this-keyword-work-in-oops  
category: "programming"  
reading_time: 1 minute  

---

# How does "this" keyword work in OOPS?

How does "this" [keyword](https://www.mindstick.com/forum/476/the-using-keyword-in-c-sharp) work in [OOPS](https://www.mindstick.com/forum/33492/oops-design-concepts-difference-between-association-and-aggregation)?

## Answers

### Answer by Arti Mishra

**‘this keyword’** this keyword is used to point to the **current object or reference.****\** **Usage of java this keyword:** There are following reason where this keyword is used.1. this keyword is used to point out the **current class instance variable.** 2. this keyword is used for **call the current class method.** 3. this keyword is also invoked the **current class constructor.** 4. this can be passed as an argument when you call the method.5. this keyword is used to **initialization the value of any variable.** 6. this keyword is used for return the current class instance from the method.\
**Working on this keyword in OOPS Concept:** **Example:**public class Student { private String name; public String getName() { return name; } public void setName(String name) { this.name = name }}class Test { public static void main(String[] args) { Student s = new Student(); s.setName(“ABCD”); System.out.println(s.getName()); }}\


---

Original Source: https://answers.mindstick.com/qa/37395/how-does-this-keyword-work-in-oops

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
