What is the difference between Super and This Keyword?
Answers were Sorted based on User's Feedback
Answer / chandrasekhar
Super is used for refer super class members.this is used for refer same class meembers
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / chandrasekhar.p
By using super we can refer the super class methods or members.This is used for refer current class members
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / skp
Call to super() should be the first statement in constructor instead of this(), otherwise it will result in compile-time error.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / deep
Super and This both are keywords and which has some predefined meaning..
Super - with the help of super, you could call super class constructor, method and member of super class..
This - it's used to avoid instance variable hiding, when local variable and instance variable has same name, then at time of assignment, local variable hides instance variable, so in order to get over this problem, this is used to refer instance variable..
class A {
int x; // instance variable
public void m(int x) {
x = x; // here local variable x hides instance variable
x.. so better use this to refer the instance variable
this.x = x; here this.x refer to instance variable and where another x is local variable
}
this is also used to call current class constructor and it can also used to pass current class constructor or method to another object..
you can also use this to call current class constructor or methods..
Rule: Call to this() must be the first statement in constructor or else it will result in compile time error..
| Is This Answer Correct ? | 0 Yes | 1 No |
what are the advantages of JTA over JTS?
1) which method of the RequestDispatcher cannot be called once the output is sent to the client? a. forward b. include c. both a&b 2) which interface should an object implement to get notified of changes to the list of active sessions in a web application? a. HttpSessionListener b. HttpSessionActivationListener c. HttpSessionAttributeLIstener 3) A user can select multiple locations from a list box on an HTML form, which of the following methods can be used to retrieve all the selected location? a. getParameter() b. getParameterValues() c. getParamValues() 4) which of the following methods should be used to send character text to the client? a. ServletResponse.getWriter() b. ServletResponse.getOutputStream() c. ServletResponse.getOut() 5) which implicit object is always available in a JSP page? a. exception b. session c. out 6) which inclusion mechanism doesn't include the source of the page, rather the output of the page. a. include directive b. jsp:include action c. Bothe a& b 7) which attribute of the page controls whether a page participates in session or not? a. session-allowed b. session c. isSession
Why threads will block on I/O?
what is DGC?
difference between ejb,struts,hibernate,spring and jsp
what are the activation groupworks?
what is a Daemon Thread?
what is Static binding?
Which class is the immediate superclass of the menucomponent class?
What is diffennce between AWT & SWING?
what are RemoteObjects?
Explain about thread synchronization inside a monitor?