Practice this Keyword in Constructors - 9.6 | 9. Methods and Constructors | ICSE Class 11 Computer Applications
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Academics
Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Professional Courses
Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβ€”perfect for learners of all ages.

games

Practice Questions

Test your understanding with targeted questions related to the topic.

Question 1

Easy

What does the this keyword refer to in a constructor?

πŸ’‘ Hint: Think about the role of `this` when creating an object.

Question 2

Easy

Why do we need this when parameters are named the same as instance variables?

πŸ’‘ Hint: Consider what happens if you don't use `this`.

Practice 4 more questions and get performance evaluation

Interactive Quizzes

Engage in quick quizzes to reinforce what you've learned and check your comprehension.

Question 1

What does the this keyword refer to in Java?

  • The current method
  • The current class
  • The current object

πŸ’‘ Hint: Think about how you address instance variables.

Question 2

True or False: The this keyword can only be used in constructors.

  • True
  • False

πŸ’‘ Hint: Consider where else you might see `this` used.

Solve 2 more questions and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Design a class Laptop that has model, brand, and year as its attributes. Create parameterized and default constructors, incorporating the this keyword appropriately.

πŸ’‘ Hint: Consider how you would differentiate attributes from parameters.

Question 2

Write a program that creates an object of a Student class with name and id. Use the this keyword correctly to initialize the attributes.

πŸ’‘ Hint: Make sure your parameters match the instance variable names.

Challenge and get performance evaluation