Can we use Stack built in class for problem solving
Stack operation
What is the use of this keyword in stack
Yes we can use built in stack
this
keyword can be used for (It cannot be used with static methods):
- To get reference of an object through which that method is called within it(instance method).
- To avoid field shadowed by a method or constructor parameter.
- To invoke constructor of same class.
- In case of method overridden,
this
is used to invoke method of current class. - To make reference to an inner class. e.g
ClassName.this
- To create an object of inner class e.g
enclosingObjectReference.new EnclosedClass