Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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 life Time; 39 String type; 140 String brand; 410 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 } 50 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. 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"; 1 A B 1 U S X2 x

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions