Question: java help, will leave a like. Given the following class, how would an instance of the class need to be declared with the password changed






Given the following class, how would an instance of the class need to be declared with the password changed to changeme after the instantiation? public class Customer \{ private String userName; private String password; public Customer(String userName, String password) \{ this.userName = userName; this.password = password; f public void setPassword(String password) f this.password - password; pub1ic String getPassword() \{ return password; f public void setuserName(String userNane) \{ this. userName = userNane; f public String getuserNane() \{ return userNane; Customer c1 = new Custoner ("user", "pass"); c1.setPassword ("changeme"); Customer c1 - new Customer ("user", "pass"); c1.password = "changeme"; Custoner c1 - new Custoner("user"," "pass"); c1. password( "changene"); Custoner c1 - new Custoner ("user"," pass"); c1. password = c1. setPassword ("changene"); public class Person \{ private String firstName; private String lastName; public Person(String firstName, String lastName) \{ this.firstNane = firstName; this.lastName = lastName; public String getFirstNane() \{ return firstNane; public String getlastName() \{ return lastNane; \} Which Photographer class would correctly inherit from Person and have a correct constructor defined? public class Photographer f private String website; private String phonellumber; public Photographer(String firstName, String lastNane, String website, String phonellumber) f this.firstNane = firstllane; this.lastllame = lastName; this.phoneNumber = phonellumber; this. website = website; 3 3 pub1lic class Photographer extends Person f private String website; private string phoneNumber; public Photographer (String firstName, string lastliame, String website, 5tring phonellusber) f this. phonettunber - phonetumber; this.vebsite - vebsite; super(firstNane, lastWane); J 3 public class Photographer extends Person \{ private String website; private String phonellumber; public Photographer(String firstName, String lastName, String website, String phoneNumber) f super(firstName, lastllane); this.phoneNumber = phonellumber; this, website = website; J \} pub11c class Photographer extends Person f private String website; private String phoneNumber; pub1ic Photographer(String firstlame, String lastlhane, 5tring nebsite, String phoneNumber) f super(firstlane, lastWame, phonemumber, website); 1 Which of the following segments of code will open the file to be able to add to it if a file exists, given the following file definition? F1le ayfile = new F1le("mylogger. log); try \{ F11es.write(myF1le.toPath(), 1ines, StandardOpenOption.APPERD); \} catch(IOException ex) System.out.printin("Error: " + ex.getMessage( ); ; \} try f FIles.write(myFile. topath(), 1ines, Standardopenoption.MRITE); 3 catch( IOException ex) \{ Systea.out,printin("Erron: " + ex.gethessage()); 3 try \{ F1les.write(myF1le.toPath(), 1ines, StandardOpenOption. WaITE); \} catch(IOException ex) \{ System.out.printin("Error: " + ex.getMessage()); \} try \{ F1les.veite(myF1le.topath(), 1ines, StandardOpenOption. CREATE_NEM); 1 catch( IOException ex) \{ System.out.printin("Error: "+ ex.gethessege()); 1 try ( Files.write(myFile.topath(), 1ines, Standardopenoption.cREATE); \} catch(10Exception ex) \{ Systen.out.printin("Errort " + ex.gethessage()); \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
