1. Engineering
  2. Computer Science
  3. use the class definition below to answer the following questions...

Question: use the class definition below to answer the following questions...

Question details

Use the class definition below to answer the following questions: [6 Marks]

public class Box 

{

     String BoxColor = “blue”;

     String BoxName;

     double BoxWeight;

     public void setBoxColor(String color) 

    {

          BoxColor = color;

     }

         

     public String getBoxName() 

     {

          return BoxName;

     }   

}

 

 

a)    How many field attributes are there in the Box class?               (2 marks)

 

b)   What is the name of the method that is an accessor?                (2 marks)

 

c)  What is the default value of BoxWeight when a new object is created?           (2 marks)

 

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution