多选题 Given the SampleClass, what is the output of this code segment?
SampleClass s = new SampleClass();
s.sampleMethod(4.4, 4);
public class SampleClass {
public void sampleMethod(int a, double b) {
System.out.println("Method 1");
}
public void sampleMethod(double b, int a) {
System.out.println("Method 2");
}
}
  • A. Method 1
  • B. Method 2
  • C. Method 1 Method 2
  • D. Method 2 Method 1
  • E. Compiler error
【正确答案】 B
【答案解析】这是一个具有重载方法的类的示例。因为传递double和int基本数据类型作为参数,所以它会调用第二个方法。A、C、D和E不正确,因为这是正确的代码,并且只调用第一个方法。