Command Line Argument
Command Line Argument
Keywords
in Java
“this” Keyword
The this keyword refers to the current object in a method or constructor.
The most common use of the this keyword is to eliminate the confusion
between class attributes and parameters with the same name (because a class
attribute is shadowed by a method or constructor parameter).
public class MyClass
{
int x;
// Constructor with a parameter
public MyClass(int x)
{ this.x = x;
} // Call the constructor
public static void main(String[] args)
{ MyClass myObj = new MyClass(5);
System.out.println("Value of x = " + myObj.x);
}
}
“super” Keyword
“super” keyword is reference variable which is used to refer immediate
parent class object.