Java SE 8 Programmer 1Z0–808 Practice Full Test 1

© examsiri.com
Question : 79 of 84
 
Marks: +1, -0
Given Code:

package clothing;
public class Shirt {
  public static String getColor() {
    return "Green";
  }
}

Given the code fragment:

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() ;
  }
}

Which two sets of actions, independently, enable the code fragment to print Fit?
Go to Question: