Question: Given a Student class that has a double instance variable called gpa and a getter and setter for that variable. What would be the output

Given a Student class that has a double instance variable called gpa and a getter and setter for that variable. What would be the output if we run the following statements in our main method:
Student s1= new Student();
Student s2= s1;
s1.setGpa(4);
s2.setGpa(4);
s1.setGpa(s2.getGpa()-1);
System.out.prinltn(s1.getGpa());
System.out.println(s2.GetGpa());

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!