Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A class called Pen is defined, for which we require three constructors. Your job is to write A) the code for the first constructor (line
A class called Pen is defined, for which we require three constructors. Your job is to write A) the code for the first constructor (line 42-44). B) the code for the second constructor (line 47-48) C) the code for the third constructor (line 51) 136 class Pen { 37 String rgbColor; 38 int lifeTime; 39 String type; 40 String brand; 41 public Pen (String rgbColor, String type, String brand) { 42 43 44 45 } 46 public Pen (String rgbColor, int lifeTime, String type, String brand) { 47 48 49 } 500 public Pen (Pen p) { 51 52 } 53 (54 } D) Now, assume that the four variables below are given. Instantiate two objects of Pen called obj1 and obj2, using two different constructors above. String color ="055255200"; int lifetime = 2; String type = "pencil"; String brand = "Staedtler
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started