JAVA(1)

更新时间:2023-07-12 23:23:52 阅读: 评论:0

                          请勿在纸上答题及写任何字体!
. 选择题(每题3分)
1(重载定义,答案:A,C)
给出如下代码:
public class MethodOver {
    public void tVar (int a, int b, float c) {
    }
}
哪两个是tVar的重载函数?AC
A. Private void tVar (int a, float c, int b) { }
B. Protected void tVar (int a, int b, float c) { }
C. Public int tVar (int a, float c, int b) (return a;)女士假发图片
D. Public int tVar (int a, int b, float c) (return a;)
E. Protected float tVar (int a, int b, float c) (return c;)
2(++,――运算符;答案:D)
给出如下代码:A
int i =1,,j =10;
do {
    if(i++> --j) {
        continue;
    }
} while (i <5);
System.out.println(“i = “ +i+ “and j = “+j);
程序运行结果是什么?
A. i = 6 and j = 5            B. i = 5 and j = 5        C. i = 6 and j = 5
D. i = 5 and j = 6        E. i = 6 and j = 6
3(线程的停止;答案:AC)
哪两个不能直接停止线程的执行?CE
A. Existing from a synchronized block.
B. Calling the wait method on an object.
C. Calling notify method on an object.
D. Calling read method on an InputStream object.
E. Calling the SetPriority method on a Thread object.
4( static关键字的使用; 答案:C)
给出如下代码:
class Test{
    private int m;
    public static void fun() {
    // some&
}
}
如何使成员变量m被函数fun()直接访问?C
A、将private int m改为protected int m            B、将private int m改为public int m
C、将private int m 改为static int m                D、将private int m改为int m
5(赋值语句,this的用法; 答案: CD
给出下面的代码段:
public class Ba{
int w, x, y ,z;
public Ba(int a,int b)
{
x=a; y=b;
}
public Ba(int a, int b, int c, int d)
{
// assignment x=a, y=b
w=d;
z=c;
}
}
在代码说明// assignment x=a, y=b处写入如下哪几个代码是正确的?BC
 A Ba(a,b);     Bx=a, y=b;         Cx=a; y=b;         Dthis(a,b);
6STRING类型数据的赋值语句;答案:AD
已知如下定义:String s = "story";
下面哪个表达式是合法的?AD
As+="books";    Bchar c=s[1];    Cint len=s.length;    DString LowerCa();
7main()函数返回值类型;答案:D
Javamain()函数的返回值是什么类型?D
A String        Bint        Cchar        Dvoid
8(JAVA标识符; 答案:A,E)
如下哪些字串是Java中的标识符?AE
A fieldname        Bsuper        C3number        D#number        E$number
9(main()函数的参数; 答案:C)
下面哪个是main()函数的合法参数?C
Achar args[]        Bchar args[][]        CString arg []        DString args
10(线程的执行; 答案:C)
以下哪个方法用于定义线程的执行体?C
A start()        Binit()        Crun()        Dmain()        Esynchronized()
铁山寺国家森林公园11(成员常量的定义; 答案:B结婚50年)
以下哪个约束符可用于定义成员常量?AB
A static    Bfinal        Cabstract        DNo modifier can be ud 
12(new的用法; 答案:E)
给出如下代码:
1: class Example{
2:    String str;
3:    public Example(){
4:        str= "example";
5:    }
6:    public Example(String s){
7:        str=s;
8:    }
9:        } }
10: class Demo extends Example{
11: }
12: public class Test{
13: public void f () {
14: Example ex = new Example("Good");
15: Demo d = new Demo("Good");
16: } }
哪句语句会导致错误?E
A line 3        Bline 6        Cline 10        Dline 14        Eline 15 
13(类的定义; 答案:B,D)
在如下源代码文件Test.java哪个是正确的类定义?BD
 A public class test {
public int x = 0;
public test(int x) 
{
this.x = x;
}
}
 Bpublic class Test{
public int x=0;
public Test(int x) {
this.x = x;
}
}
 Cpublic class Test extends T1, T2 {
public int x = 0;
public Test (int x) {
this.x = x;
落得打
}
碰碰车游戏}
 D public class Test extends T1{
public int x=0;
public Test(int x){
this.x = x;
}
 Eprotected class Test extends T2{
public int x=0;
public Test(int x){
this.x=x;
}
}
14 (if el if的用法(太简单); 答案:D)
给出下面的代码:
if (x>0) { System.out.println("first"); }
el if (x>-3) { System.out.println("cond"); }
el { System.out.println("third"); }
x的取值在什么范围内时将打印字符串"cond"  D
A. x > 0        B. x > -3        C. x <= -3        D. x <= 0 & x > -3
15平板电脑的系统(数组下标,lenth()的用法; 答案:B)
已知表达式int m[] = {0, 1, 2, 3, 4, 5, 6 };
下面哪个表达式的值与数组下标量总数相等?D
A m.length()        Bm.length        Cm.length()+1        Dm.length+1
16(数组; 答案:B)
已知如下代码:
public class Test
{
long a[] = new long[10];
public static void main ( String arg[] ) {
蛋炒饭什么意思System.out.println ( a[6] );
}
}
请问下列哪个描述是正确的? C
AOutput is null.                            BOutput is 0.
CWhen compile, some error will occur.    DWhen running, some error will occur.
17(native方法的定义; 答案:A)
如下哪个语句正确说明了native方法?B
Apublic native void test();        Bpublic native void test(){}
Cpublic void native test();        Dpublic native test(){} 
18(EJB; 答案: D)
What is a benefit of bean pooling in an EJB container?
A. It improves the portability between databas.
B. It reduces the number of databa connections.
C. It provides better support to object-oriented databas.
D. It reduces the memory allocation and garbage-collection cycles.
19(继承的概念; 答案A,D)
下面关于继承的哪些叙述是正确的?AD
A. java中只允许单一继承。
B. java中一个类只能实现一个接口。
C. java中一个类不能同时继承一个类和实现一个接口。
D. java的单一继承使代码更可靠。
20妹妹简笔画(垃圾收集的概念; 答案:B)
关于垃圾收集的哪些叙述是正确的?BD
A. 程序开发者必须自己创建一个线程进行内存释放的工作。

本文发布于:2023-07-12 23:23:52,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1079065.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:定义   线程   代码   继承   语句   函数
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图