public int cal(int x,int y,float z){return 0;}
public int cal(int x,int y,int z){return 0;}
public void cal(int x,int z){}
public viod cal(int z,int y,int x){}
第1题:
( 19 )阅读下列代码
public class Test2005{
public static void main(String args[]){
String s= ″ Test ″ ;
Switch(s){
case ″ Java ″ : System.out.print( ″ Java ″ ) ;
break ;
case ″ Language ″ : System.out.print( ″ Language ″ ) ;
break ;
case ″ Test ″ : System.out.print( ″ Test ″ ) ;
break ;
}
}
}
其运行结果是
A ) Java
B ) Language
C ) Test
D )编译出错
第2题:
下列代码的下划线处应填入的方法名是______。
import java.awt.*;
import java.applet.*;
public class Hello extends Applet{
public void______(Graphics g){
g.drawString("How are you!", 10, 10);
}
}
A) repaint
B) println
C) paint
D) show
A.
B.
C.
D.
第3题:
下面的Applet获取了相对于getDocumentBase()方法返回的目录路径为graph/java.gif的图像文件,并将它显示出来。在下面程序的划线处填入相应的语句。
import java.awt.*;
import java.applet.Applet;
public class Test extends Applet {
Image img;
public void init() {
【 】
}
public void paint (Graphics g) {
g.drawlmage (img,30,25,this);
}
}
第4题:
如下两个源程序文件,分别编译后,运行Example.class文件,运行结果为______。
AB.java文件代码如下;
package test;
public class AB
{
int a=60;
public void show()
{
System.out.println(”a=”+a);
}
Example.java文件代码如下:
import test.AB;
class Example
{
public static void main(String args[])
{
AB bj=new AB();
obj.show();
}
}
第5题:
A.t.f
B.this.n
C.Test.m
D.Test.n
第6题:
下列Applet在坐标 ( 20,20) 处显示一幅GIF图像,在横线处填入正确的语句。
import java. net.*;
import java. awt.*;
import java. applet.*;
public class Test extends Applet {
Image IMG;
public void init() {
URL url = getDocumentBase ();
String name="IMG.gif";
【 】
}
public void paint(Graphics g) {
g. drawImage ( IMG,20,20,this);
}
}
第7题:
请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”
Class Test 【 15 】 {
Public static void main (String[] arge){
Test t = new Test();
t.start();
}
Public void run(){
System.out.println( “ Hello! ” );
}
第8题:
阅读下列代码 public class Test 2005{ public static void main(String args[]){ Strings="Test"; switch(s){ case "Java":System.out.print("Java"); break; case "Language":System.out.print("Language"); break; case "Test":System.out.ptint("Test"); break; } } } 其运行结果是
A.Java
B.Language
C.Test
D.编译出错
第9题:
A.public class test { public int x = 0; public test(int x) { this.x = x; } }
B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }
C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
D.public class
第10题:
类Test定义如下,将下列______方法插入③行处是不合法的。 ( )①public class Test{②public float Method(float a,float b){}③④}
A.public float Method(float a,float b,float c){}
B.public float Method(float c,float d){}
C.public int Method(int a,int b){}
D.private float Method(int a,int b,int c){}