logo

Crowdly

Browser

Add to Chrome

// Student.java package unit01.quiz; public class Student{ public...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

// Student.java

package unit01.quiz;

public class Student{

public static String university;

private final String name;

private double gpa; // grade point average

public Student(String name, double gpa){

this.name = name;

this.gpa = gpa;

}

public String getName(){

return name;

}

public void setGPA(double gpa){

if (gpa < 0 || gpa > 4.0) {

System.out.println("Wrong argument value!");

} else {

this.gpa = gpa;

}

}

}

// Main.java

package unit01.quiz;

public class Main {

public static void main(String[] args) {

Student student = new Student("Paul",3.2);

}

}

Which statements do NOT WORK in main() (syntax errors or syntax warnings; note that the object student is already created in main())?

1) Student.university = "JKU";

2) student.name = "Walter";

3) System.out.print(student.getName()+"'s University: " + Student.university);

4) student.setGPA(4.0);

System.out.print(student.getName()+"'s GPA: " + student.gpa);

0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.jku.at?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome