R4R
Right Place For Right Person TM

What is constructor chaining and how to do this in Java?

previous previous previous
Question:
What is constructor chaining and how to do this in Java?

Question:What is constructor chaining and how to do this in Java?


Answer
Contructor can be overloaded,i.e. a single class can hava more than one contructor. A construct may call to another constructor. The first statement in the constructor must be a call to either this() or super() but not both. The super() will call the matching superclass constructor according to the number of arguments passed in the super(). A this() will call the overloaded constuctor in the same class according to the parameter list. The called constructor may also make a call to the other constructor using this(). This type of contructor calling in the same class is called constructor chaining.

By:Jalees
Date:

What is constructor chaining and how to do this in Java?

Post Your Answers


User Name:
Answers:

Related Links

  1. What is passed by ref and by value?
  2. In DB access where to write the query. In JSP or servlet?
  3. Explain difference between Constructer and a method
  4. What are differences between procedural and object oriented language?
  5. Why threads block or enters to waiting state on I/O?
  6. What are transient variables in java?
  7. How Observer and Observable are used?
  8. What is List interface ?
  9. What is the difference between yield() and sleep()?
  10. Can we call finalize() method ?
  11. What is the initial state of a thread when it is created and started?
  12. Can we declare an anonymous class as both extending a class and implementing an interface?
  13. What is the differences between boolean & operator and && operator?
  14. What is an abstract method ?
  15. what is a the difference between System.err and System.out
  16. What is the difference between synchronized block and synchronized method ?
  17. How can you force garbage collection in java?
  18. How can you call a constructor from another constructor ?
  19. How can you call the constructor of super class ?
  20. What must be the order of catch blocks when catching more than one exception?
  21. How can we call a method or variable of the super class from child class ?
  22. If you are overriding equals() method of a class, what other methods you might need to override ?
  23. What is externalizable ?
  24. Does garbage collection guarantee that a program will not run out of memory?
  25. What is a native method?
  26. What is the difference between a continue statement and a break statement?
  27. What must a class do to implement an interface?
  28. What is the difference between notifyand notifyAll method ?
  29. What does wait method do ?
  30. What are the different states of a thread ?
  31. What is the difference between static and non static inner class ?
  32. What is the difference between readers and streams?
  33. Why we cannot override static methods?
  34. When does a compiler supplies a default constructor for a class?
  35. What will happen if an exception is not caught ?
  36. What are the different ways in which a thread can enter into waiting state?
  37. What is a ResourceBundle class?
  38. What is numeric promotion?
  39. What is the difference between the prefix and postfix forms of the ++ operator?
  40. What is the difference between a switch statement and an if statement?
  41. What is hashCode?
  42. What is the difference between RandomAccessFile and File?
  43. What is the difference among JVM Spec, JVM Implementation, JVM Runtime ?
  44. What is the difference between Hashtable and HashMap ?
  45. Why java is said to be pass-by-value ?
  46. What do you mean by immutable ? How to create an immutable object ?
  47. What is a weak reference ?
  48. What is object cloning?
  49. What is object pooling?
  50. What is the disadvantage of garbage collection?

Question:What is constructor chaining and how to do this in Java?

Back Home Next

New Updates

Topics

Topics

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R