SCJP題庫第029題


l1. public class A{
l2.   public void doit(){
l3.        }
l4.   public String doit(){
l5.            return "a";
l6.   }
l7.   public double doit(int x){
8.           return 1.0;
l9.        }
l10.}
lWhat is the result?

A. An exception is thrown at runtime.
B. Compilation fails because of an error in line 7.
C. Compilation fails because of an error in line 4.
D. Compilation succeeds and no runtime errors with class A occur.

Ans:C

解說:

同一個類別中,方法若名字一樣,參數列必需不一樣!

Comments

Popular posts from this blog

Android+Google Map API v3 Geocoding(地址轉經緯度度