Use the class definition below to answer the following questions:- public class CBox { String BColor = “blue”; String BName; double BWeight; public void setBColor(String c) { BColor = c; } public String getBName() { return BName; } } a) Name any 2 field attribute for this class and their type? b) What is the name of the method that is a mutator? c) Why is the return type for the getBName method String?

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter1: Creating Java Programs
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question

Use the class definition below to answer the following questions:-

public class CBox 

{

     String BColor = “blue”;
     String BName;
     double BWeight;

     public void setBColor(String c) 
    {
          BColor = c;
     }        

     public String getBName() 
     {
          return BName;
     }   
}

 

a)  Name any 2 field attribute for this class and their type?

b)  What is the name of the method that is a mutator?

c)  Why is the return type for the getBName method String?

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT