Question: please help me quick Consider the code set below. 3 public class Ex1_RunSetGet { public static void main(String[] args) { 5 6 SetGet sg =
Consider the code set below. 3 public class Ex1_RunSetGet { public static void main(String[] args) { 5 6 SetGet sg = new SetGet("Samuel"); 7 8 System.out.println(sg.getName(); 9 } 10) 11 12 class SetGet ( 13 14 private String name="Kevin": 15 16 SetGet(String name) { 17 18 } 19 20 public void setName(String n) { 21 name = n; 22 } 23 24 25 26 27 ) What is the correct statement to be inserted in line 7 to change the value of the variable name on object sg to *Priya? Osg.setName("Kevin","Priya"); Osg.setName("Priya"); O sg.setName(String "Priya"); setName("Priya"); setName(String "Priya")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
