File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

another question

 
kavita s. kumar
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following class definition:
1. public class Test extends Base {
2. public Test(int j) {
3. }
4. public Test(int j, int k) {
5. super(j, k);
6. }
7. }
Which of the forms of constructor must exist explicitly in the definition of the Base class?
an anyone solve my prob
 
Fei Ng
Ranch Hand
Posts: 1244
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kavita s. kumar:
Consider the following class definition:
1. public class Test extends Base {
2. public Test(int j) {
3. }
4. public Test(int j, int k) {
5. super(j, k);
6. }
7. }
Which of the forms of constructor must exist explicitly in the definition of the Base class?
an anyone solve my prob

Base() {}
Base(int j, int k) {}
 
kavita s. kumar
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could u eplain me how Base(){}??
 
Ahmed Haboubi
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Base() because in any child class constructor, if there's no explicit call to this(..) or supre(..), the compiler will implicitly insert super(). So, there has to be a Base() in the parent class.
I hope this helps.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic