package clothing; public class Shirt { public static String getColor() { return "Green"; } }
package clothing.pants; // line n1 public class Jeans { public void matchShirt(){ //line n2 if(color.equals("Green")) { System.out.print("Fit"); } } public static void main (String[] args) { Jeans trouser = new Jeans(); trouser.matchShirt() ; } }
At line n1 insert: import clothing.Shirt; At line n2 insert: String color = getColor();
At line n1 insert: import clothing.*; At line n2 insert: String color = Shirt.getColor();
At line n1 insert: import static clothing.Shirt.getColor; At line n2 insert: String color = getColor();
At line n1 no changes required. At line n2 insert: String color = Shirt.getColor();
At line n1 insert: import clothing; At line n2 insert: String color = Shirt.getColor();