Which line of code initializes a student instance?

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?

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?

A.
Student student1;

B.
Student student1 = Student.new();

C.
Student student1 = new Student();

D.
Student student1 = Student();



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Hans

Hans

C, A in only decleration, C is decleration and initialization.