Free Jobs

Java Forums: Core Java (15) J2EE (3) EJB (5) Servlet (3) JDBC (6) Hibernate (2) Struts (1) Swing (1) Oracle (7) JSP (4) Other (10)

Topic: what is the use of super and this keyword in java

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share

User: manishav3388 Post Date: 26 Jan 2011 00:32

super and this keyword is used in java to refer to immediate parent class
and current class respectively.

Main Content:
Below is the description of this and super

This:This can be used inside a method and it returns a reference to
the current object on whih the method is being called.
also a property of the current object can be set by this key word

For example if there is a object called Person we can call
this.age = 30 to set the age of the person.

Super : A super keyword can be used to set the properties of the object
of a parent class or it can also be used to call the constructor of super class
from current class.

Note that super() should be always be the first line of statement inside a
subclass constructor.

About Writer:
hello,I am JAVA Developer from Noida.

Writer's Link: http://

Writer's Email:

Post Comment

Similar Articles Top ArticlesLatest Articles Other Articles by this Author Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)