ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
how to call One constructor from another;
 Question Submitted By :: Neeraj_passion2001
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to call One constructor from another;
Answer
# 1
by using super keyword
 
Is This Answer Correct ?    10 Yes 1 No
Zorif
 
  Re: how to call One constructor from another;
Answer
# 2
Hi,

Using super you can invoke constructor which is in parent 
class. to invoke constructor which is in the same class we 
have to use this. for example:

public class Point {
    int m_x;
    int m_y;

    //============ Constructor
    public Point(int x, int y) {
        m_x = x;
        m_y = y;
    }

    //============ Parameterless default constructor
    public Point() {
        this(0, 0);  // Calls other constructor.
    }
    . . .
}
 
Is This Answer Correct ?    8 Yes 2 No
Ajay
 
 
 
  Re: how to call One constructor from another;
Answer
# 3
I think we find that anything you could have done in Java by
calling the default constructor from another constructor,
you can do easily in Curl by calling the default constructor
from a factory.
 
Is This Answer Correct ?    2 Yes 2 No
Talk2sreenivas@gmail.com
[Intac-india.com]
 
  Re: how to call One constructor from another;
Answer
# 4
. In one constructor, the first statement can be a call on
another constructor in the same class (use keyword this
instead of the class-name) or a call on a constructor of the
superclass (use keyword super instead of the class-name). In
a constructor for a subclass, the first statement must be
either this(…); or super(…); —if not, the call super(); is
automatically inserted for you.
 
Is This Answer Correct ?    3 Yes 0 No
Talk2sreenivas@gmail.com
[Intac-india.com]
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod TCS3
whats the diff between jsp and servlets? HCL8
what Data encapsulation in java?  2
What is the difference between pageContext and page implicit objects in jsp? Merrill-Lynch6
Differentiate Vector and ArrayList? Wipro3
which one the better thread emplemented thread or extended ? Fidelity3
what is java  8
Howmany classes that package java.applet.* contains? TCS1
What is Remote Interface ? CTS2
what are the purposes of native, transiant key words?  2
Can an unreachable object become reachable again?  3
how can u apply shallow cloning and deep cloning to create object? Yash-Technologies1
Is it possible to create Userdefined Unchecked Exception also?If Yes, give an example?  2
Which of the following can be referenced by a variable? A. The instance variables of a class only B. The methods of a class only C. The instance variables and methods of a class  1
what is difference between method overloading & method overridding with example? IBM2
What is a default package ?  4
How 'java' got its name and what it stands for?  3
What is adapter class?  2
Can you declare a static variable in a method?  3
what is difference between requestprocessor and request dispatcher? Tech-Mahindra1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com