Oracle
1Z0-815 · Question #65
View the exhibit: public class Student { public String name = ""; public int age = 0; public String major = "Undeclared"; public boolean fulltime = true; public void display() {…
The correct answer is C. Student student1 = new Student(). See the full explanation below for the reasoning.
Question
View the exhibit:
public class Student { public String name = ""; public int age = 0; public String major = "Undeclared"; public boolean fulltime = true; public void display() { System.out.println("Name: " + name + " Major: " + major); } public boolean isFullTime() { return fulltime; } } Which line of code initializes a student instance?
Options
- AStudent student1;
- BStudent student1 = Student.new();
- CStudent student1 = new Student();
- DStudent student1 = Student();
How the community answered
(23 responses)- A9% (2)
- B4% (1)
- C74% (17)
- D13% (3)
Community Discussion
No community discussion yet for this question.