Question: public class Pair { public static int counter = 0; private String name: public double value; public String getName return home 1 public void setName(String


public class Pair { public static int counter = 0; private String name: public double value; public String getName return home 1 public void setName(String name) { this.name names } public double getValue { return value; } public void setValue(double value) { this.value = value; 3 Pair(String name, double value) { setName(name); setValue(value); counter 3 public static void main(String[args) { Pair one = new Pair("Audrey", 99.9) Pair two = new Pair("Matthew", 90.0); Pair three = new Pairc Isabella", 92.0 System.out.println(one.getName System.out.println(two.getValue); / System.out.println(three.counter); // two = one, same name); setValue(value); counter lic static void main(String[] args) { Pair one = new Pair("Audrey", 99.9); Pair two = new Pair("Matthew", 90.0); Pair three = new Pair("Isabella", 92.0); System.out.println(one.getName(); // System.out.println(two.getValue(); // System.out.println(three.counter); // two one System.out.println(two.getName); // one. counter = 0; System.out.println(three counter); //
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
