Identify the line of code to be placed in Line 27 of the code snippet given below to display the zipCode of the customer.
class Address {
private int zipCode;
public Address(int zipCode) {
this.zipCode= zipCode;
}
public int getZipCode() {
return zipCode;
}
}
public class Customer {
public Address address;
public String name;
public Customer(String name, int zipCode) {
this.name = name;
address = new Address(zipCode);
}
}
public class Tester{
public static void main(String args[]) {
Customer customer = new Customer("Sam",100001);
// Line 27
}
}
System.out.println(this.address.getZipCode());
System.out.println(customer.address.zipCode);
System.out.println(customer.address.getZipCode());
Compilation error - not possible to access the zipCode of Address class
To get all Self Assessment - Programming using Java Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee