Question: Examine the following code for a constructor. Which option will create a new instance of the Trees class? public class Trees { String species;
Examine the following code for a constructor. Which option will create a new instance of the Trees class? public class Trees { String species; public Trees(String trees) { this species = species; } O Trees-new "elm": O new Trees("elm"); Trees tree new Trees(elm"); O Trees tree new Trees()
Step by Step Solution
3.46 Rating (159 Votes )
There are 3 Steps involved in it
The correct option is new Treeselm This is because it calls the constructor of the Trees class an... View full answer
Get step-by-step solutions from verified subject matter experts
