I m doing some problems regarding Return type in java.I m facing some problem . could any help plz.
1. class Plant {
2. String getName() { return "plant"; }
3. Plant getType() { return this; } // what mean 'return this' here
4. }
5. class Flower extends Plant {
6. // insert code here(I have four options A-D. A,C,D are correct here but don't know why? Anyone explain. )
A. Flower getType() { return this; }
B. String getType() { return "this"; }
C. Plant getType() { return this; }
D. Tulip getType() { return new Tulip(); }
7. }
8. class Tulip extends Flower { }