Question: java language 1. Create a class Doll with one attribute name of type String. Include set and get method for attribute name. Doll name: String
1. Create a class Doll with one attribute name of type String. Include set and get method for attribute name. Doll name: String + setName(String):void + getName():String +pressMe():void Sample Code: public class Doll { private String name; public Doll() { name= ""; } public Doll(String n) { setName(n); } public void setName(String n) { name = n;} public void pressMe ## { System.out.println("Hi I am + name); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
