What is the use of ?this??

Answer Posted / ashokmail

'this' operator is used to denote the current working
object.

EX:
Class student{
public student(){
this.addStudent();
}
public void addStudent(){
// to do code here
}
public static void main(String args[]){
new student();
}
}

'this' in the constructor is used to denote the current
working object student...

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different access modifiers available in java?

658


Is string thread safe in java?

690


What happens if a constructor is declared private?

627


Can we catch more than one exception in a single catch block?

709


What is a line break example?

657






What is exception handling in java?

653


What is tostring () method?

653


What will happen if static modifier is removed from the signature of the main method?

608


If a method is declared as protected, where may the method be accessed in java programming?

584


How do you clear a method in java?

619


What is the difference between instanceof and isinstance?

655


How to implement an arraylist in java?

601


What are the different types of inner classes?

624


What is meant by method?

653


How do you declare a variable?

713