单项选择题

编译如下的Java程序片段: 
Class test{    
Int count=9;   
 Public void a(){ 
 Int count=10;  
System.out,println(“count 1=” + count); } 
Public void count(){  
System.out.println(“count 2 =”+ count); } 
Public static void main(String args[] ){  
Test t=new Test();  
t.a();  
t.count(); } } 
结果是()

A.不能通过编译
B.输出:count 1 =10  count 2=9
C.输出:count 1=9 count 2=9


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题在Servlet中,下列语句可以正确获取PrintWriter对象的是()  

A.PrintWriter out = request.getWriter();
B.PrintWriter out = request.getPrinteWriter();
C.PrintWriter out = response.getWriter();
D.PrintWriter out = responce.getPrinteWriter();

2.单项选择题在JAVA语言中,下列语句()可以画出一矩形框架,其距上边界为10,宽为30像素,高为40象素  

A.Graphics g=new Craphics();   g.drawRect(10,0,30,40);
B.Graphics g=new Craphics();   g.drawRect(0,10,30, 40);
C.Graphics g=new Craphics();   g.drawRect(30,40,10, 0);
D.Graphics g=new Craphics();   g.drawRect(30,40,0,10);

3.单项选择题实体Bean的生命周期中,只有在()方法成功完场后,ejbPostCeate()方法才能调用  

A.ejbActivate()
B.ejbPassivate()
C.ejbCreate()
D.ejbRemove()

4.单项选择题J2EE中,标记的作用是()。

A.<jsp:setProperty>和<jsp:getProperty>必须在一个jsp文件中搭配出现 
B.就如同session.setAttribute()一样,来设置属性/值对
C.和<jsp:useBean>动作一起使用,来设置bean的属性值 
D.就如同request.setAttribute()一样,来设置属性/值对

5.单项选择题

在J2EE中,对于简单属性的方法:
public Color getColor(){…} 和public Void setColor(Color c){…}
假定color是类中的属性,在方法体内可以() 

A.  在getColor方法体内只能有一行代码:return color; 在setColor方法体内只能有一行代码: this.color=c;
B.  在getColor方法体内只能有一行代码:return color; 在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码
C.  在getColor方法体内一定有该行代码:return color; 但还可以有其他的代码, 在setColor方法体内只能有该行代码: this.color=c;
D.  在getColor方法体内一定要有该行代码:return color; 但还可以有其他的代码,在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

6.单项选择题使用()修饰符时,一个类能被同一包或者不同包中的其他类访问。  

A.  private
B.  pretected
C.  public
D.  friendly

7.单项选择题在J2EE中,系列选项中,()可以得到URLCconnection类对象。  

A.使用URL对象的openConnection()方法得到
B.使用URLConnection类的静态方法openConnection()方法得到
C.使用URL对象的getConnection()方法得到
D.使用URLConnection类的静态方法getConnection()方法得到

9.多项选择题在J2EE中,对于ResultSet接口中的getInt方法,参数可以是() 

A.布尔型
B.整型
C.字符串型
D.浮点型

10.多项选择题在J2EE中,URL类代表了统一资源定位器,如果要使用 “http://www.sina.com.cn/index.html”生成URL对象,可以按照如下的()造该对象。 

A.URL url=new URL("http","www.sina.com.cn/index.html",80);
B.URL url=new URL("http://www.sina.com.cn/index.html");
C.URL url=new URL("http","www.sina.com.cn",80,"index.html");
D.Url url=new URL("http","www.sina.com.cn/index.html");