欢迎来到牛牛题库网 牛牛题库官网
logo
全部科目 > Java认证考试 > Java认证考试综合练习

单项选择题

现有: 
class TestFoo f     
int x; 
String y; 
int  getX()  {  return  x;  }    
String getY()  {return y;  }     
void setX (int  x)  {     
int Z=7:     
this.x=x;     
}     
可以添加多少个修饰符来封装此类?()     

A.5
B.4
C.3
D.2

点击查看答案&解析

相关考题

单项选择题
我们定义一个Account类来描述银行账户,银行账户有账户名、金额等属性特征,同时有存款、取款等行为特征,下述代码适合描述的是哪项?()     

A.class  Accountf        String name;//账户     S    tring amount;  //金额        Account (String name)(    )   void deposit (double mount){  //存款     )   void withdraw (double mount){  //取款     }     )
B.class  Accountf       String name;//账户d  ouole amount;  //金额       Account(double amount){   }  void deposit (double mount){  //存款     )  void withdraw (double mount){  //取款     )     )
C.class  Accountf        String name;//账户   double amount;  //金额       Account (String name){}    void deposit (double mount){//存款     )      void withdraw (double mount){  //取款     )     )
D.class Accountf        String name;//账户        double amount;//金额      Account (String name){}        void deposit(){//存款     )   void withdraw(){//取款 )     )

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题