Inner Classes and Exceptions

Inner Classes in Java: Types and Usage

1/8

Street is an inner class of the Town. Update the code to create a legal instance of Street class. 

public static void main(String[] args) {
  Town town = new Town(); 
  ??? street= ???;
  street.seeTown();
}
public static void main(String[] args) {
  Town town = new Town(); 
  Town.Street street = town.new Street();
  street.seeTown();
}
Comments