Multiple Choice
Class Definition Ch 04-1
import java.text.DecimalFormat;
public class Student
{
private String name;
private String major;
private double gpa;
private int hours;
public Student(String newName, String newMajor, double
newGPA, int newHours)
{
name = newName;
major = newMajor;
gpa = newGPA;
hours = newHours;
}
public String toString()
{
// xxxx needs to be replaced
DecimalFormat df = new DecimalFormat("xxxx") ; return name + "\n" + major + "\n" + df.format(gpa)
+ "\n" + hours
}
}
-Refer to Class Definition Ch 04-1: Which of the following could be used to instantiate a new Student s1?
A) Student s1 = new Student() ;
B) s1 = new Student() ;
C) Student s1 = new Student("Jane Doe", "Computer Science", 3.333, 33) ;
D) new Student s1 = ("Jane Doe", "Computer Science", 3.333, 33) ;
E) new Student(s1) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q26: Class Definition Ch 04-4<br>public class Box<br>{<br>double length;<br>double
Q27: The interface of a class is based
Q28: Every class definition must include a constructor.
Q29: A variable whose scope is restricted to
Q30: What happens if you declare a class
Q32: Because an Image cannot directly be added
Q33: Class Definition Ch 04-4<br>public class Box<br>{<br>double length;<br>double
Q34: If a method does not have a
Q35: While multiple objects of the same class
Q36: Class Definition Ch 04-1<br>import java.text.DecimalFormat;<br>public class Student<br>{<br> private