How would you declare the Clothing constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How would you declare the Clothing constructor

Clothing item1 = new Clothing("Blue Jacket" , 20.9 ,"M");

6th Jul 2021, 12:37 PM
Chamudi Kolapadi
3 Answers
+ 4
Clothing(String a, float b, String c){...}
6th Jul 2021, 12:53 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
0
Ciro Pellegrino it's better if we declare char type for the gender
6th Jul 2021, 6:34 PM
Suhail Pappu
Suhail Pappu - avatar
0
Suhail Pappu "M" is a String, 'M' is a char. Asking for a char where client use a String ... Error! I don't make assumptions, I stick to the track.
7th Jul 2021, 6:43 AM
Ciro Pellegrino
Ciro Pellegrino - avatar