Question: In the Bear class, complete the public method definition for setColor() with the string parameter newColor. Ex: If the input is 8 black, then the

In the Bear class, complete the public method definition for setColor() with the string parameter newColor. Ex: If the input is 8 black, then the output is: Age : 8 Color: black Bear.java BearDetails.java import java . util. Scanner; NP public class BearDetails { public static void main(String args) { Scanner sonr = new Scanner (System. in); Bear bear1 = new Bear ( ); int userAge; String userColor; LO OO 10 userAge = scnr . nextInt(); 11 userColor = scnr . next(); 12 13 bear1 . setAge (userAge ) ; 14 bear1 . setColor (userColor) ; 15 16 System. out . printIn("Age: " + bear1 . getAge( ) ); 17 System. out . printIn("Color: " + bear1.getColor() ); 18

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!