黑马程序员技术交流社区

标题: 每日五题__(2) [打印本页]

作者: fso918    时间: 2011-9-27 10:17
标题: 每日五题__(2)
Q7
Given :
class A{
         A(){}
}

class B extends A{
}
Which two statements are true?(choose two)
A  Class B's constructor is public .
B  Class B's constructor is no arguments.
C  Class B's constructor includes a call to this().
D  Class B's constructor includes a call to super().

Q8
Given:
int i = 1 , j = 10;
do{
     if(i>j){
           break;
     }
     j--;
while(++i < 5);
System.out.println("i ="+i+"and j ="+j);

What is the result?
A  i = 6 and j = 5.
B  i = 5 and j = 5.
C  i = 6 and j = 4.
D  i = 5 and j = 6,
E  i = 6 and j = 6.

Q9
About assertion:
Which statement is true?
A  Assertions can be enabled or disabled on a class-by-class basis.
B  Conditional conpilation is used to allow tested classes to tun at full speed.
C  Assertions are appropriate for cheeching the validity of arguments in a method.
D  The programmer can choose to excute a return statement or to throw an exception if an assertion fail.

Q 10
You want a class to have access to members of another class in the same package .Which is the most restrictive access that accomplisnes this objective?
A  public
B  private
C  protected
D  transient
E  default access

Q11
Given
int x = 3;
int y = 1;
if( x=y){
  System.out.println("x = "+x);
}

Which is the result?
A  x = 1;
B  x = 3;
C  Compilation fails.
D The code runs with no out put.
E  An exception is thrown at runtime.
[ 本帖最后由 fso918 于 2011-09-27  11:30 编辑 ]
作者: 匿名    时间: 2011-9-27 10:18
Answer: 7 BD  8  D  9  A  10  E  11  C
作者: 匿名    时间: 2011-9-27 13:44
7BD   8D     9 D  10B    11 E




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2