Podcast
Questions and Answers
The GradeBook constructor is used to specify the course name at the time each GradeBook object is created.
The GradeBook constructor is used to specify the course name at the time each GradeBook object is created.
True (A)
In the GradeBookTest class, 'gradeBook1' was created with the course name 'CS102 Data Structures in Java'.
In the GradeBookTest class, 'gradeBook1' was created with the course name 'CS102 Data Structures in Java'.
False (B)
The displayMessage method in the GradeBook class will print a welcome message with the course name.
The displayMessage method in the GradeBook class will print a welcome message with the course name.
True (A)
In GradeBookTest main method, gradeBook2's course name is displayed before gradeBook1's course name.
In GradeBookTest main method, gradeBook2's course name is displayed before gradeBook1's course name.
The GradeBookTest class contains the main method that begins the program execution.
The GradeBookTest class contains the main method that begins the program execution.
The GradeBook class does not have a method to retrieve the course name.
The GradeBook class does not have a method to retrieve the course name.
In the Java program, the initial value of the course name is null.
In the Java program, the initial value of the course name is null.
The GradeBook object is created using the 'new' keyword in the program.
The GradeBook object is created using the 'new' keyword in the program.
The program prompts the user to enter the course name using a Scanner object.
The program prompts the user to enter the course name using a Scanner object.
The setCourseName method is used to set the course name in the GradeBook object.
The setCourseName method is used to set the course name in the GradeBook object.
The displayMessage method is called after setting the course name.
The displayMessage method is called after setting the course name.
The program imports a package named 'java.util.Scanner'.
The program imports a package named 'java.util.Scanner'.
In the GradeBook class, the courseName instance variable is declared as 'private'.
In the GradeBook class, the courseName instance variable is declared as 'private'.
The method 'setCourseName' in the GradeBook class returns a value of type 'String'.
The method 'setCourseName' in the GradeBook class returns a value of type 'String'.
The 'displayMessage' method in the GradeBook class calls the 'getCourseName' method to get the name of the course.
The 'displayMessage' method in the GradeBook class calls the 'getCourseName' method to get the name of the course.
In GradeBook.java, 'public' keyword is used for most instance variables.
In GradeBook.java, 'public' keyword is used for most instance variables.
Encapsulation is achieved by declaring instance variables in the GradeBook class as public.
Encapsulation is achieved by declaring instance variables in the GradeBook class as public.
The return type in a method declaration indicates the item passed to that method.
The return type in a method declaration indicates the item passed to that method.