没有合适的资源?快使用搜索试试~ 我知道了~
《JAVA语言》西安交大在线作业参考资料.docx
需积分: 5 0 下载量 57 浏览量
2024-04-16
15:20:36
上传
评论
收藏 35KB DOCX 举报
温馨提示
试读
16页
此文档为《JAVA语言》西安交大在线作业参考资料。 主要包含JAVA语言的基础知识和面向对象编程的特性。 内容概要包括基本语法、异常处理、线程模型和并发编程概念等核心要点。 适用人群主要是学习JAVA语言的大学生或者初学者,特别是西安交通大学的学生,因为这是为他们提供的在线作业参考材料。 使用场景及目标主要是在学习和理解JAVA语言的过程中,作为辅助资料进行查阅和学习,帮助学生掌握JAVA语言的基本概念和编程技巧,完成相关的课程作业。 同时,对于准备参加相关考试或进行项目开发的人群,也可以作为复习和参考的资料。
资源推荐
资源详情
资源评论
《JAVA 语言》
1.下面那一项不会出现编程错误(D)。
A.忘记多行注释符的一个定界符
B.一个标识符的大小写字母使用不当
C.括号不成对出现
D.在一个显示图形用户界面的应用程序中调用 System .exit
2.有一段 java 应用程序,它的主类名是 a1,那么保存它的源文件名可以是(A)
A.a1.java B.a1.class C.a1 D.都对
3.对方法 main 的第 1 行定义正确的是(D)。
A.public main( String arg [ ] )
B.public void main( String arg [ ] )
C.public static void main( String arg [ ] )
D.public static void main( String args [ ] )
4.指出下列程序运行的结果
public class Example{
String str=new String(""good"");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+"" and "");
Sytem.out.print(ex.ch);
}
public void change(String str,char ch[]){
str=""test ok"";
ch[0]='g';
}
} (B )
A.good and abc B.good and gbc
C.test ok and abc D.test ok and gbc
5."给出下面代码:
public class Person{static int arr[] = new int[10];
public static void main(String a[])
{
System.out.println(arr[1]);
}
}
那个语句是正确的?(C )
A.编译时将产生错误; B.编译时正确,运行时将产生错误;
C.输出零; D.输出空。
6.运行下列程序,会产生什么结果(B)
class Outer1{
privateint a;
void foo(double d,final float f){
String s;
finalboolean b;
class Inner{
voidmethodInner( ){
System.out.println("in the Inner");
}
}
}
public static void main(String args[])
{
Outer1 me=new Outer1( );
me.foo(123,123);
System.out.println("outer");
}
} 。。
A.in the Inner outer B.outer
C.in the Inner D.编译不通过
7.下面不是合法标识符的是(A )
A.2ofUS B.giveMes
C.whataQuiz D.$d2000_
8.设 x 为 float 型变量,y 为 double 型变量,a 为 int 型变量,b 为 long 型变量,c 为 char 型
变量,则表达式 x+y*a/x+b/y+c 的值为(C )类型。
A.int B.long C.double D.char
9.容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改
变?(B )
A.CardLayout B.FlowLayout
C.BorderLayout D.GridLayout
10."下列代码哪几行会出错:
1) public void modify() {
2) int I, j, k;
3) I = 100;
4) while ( I > 0 ) {
5) j = I * 2;
6) System.out.println ("" The value of j is "" + j );
7) k = k + 1;
8) I--;
9) }
10) } ( C)
A.line 4 B.line 6 C.line 7 D.line 8
11.类 Teacher 和 Student 是类 Person 的子类;C
Person p;
Teacher t;
Student s;
//p, t and s are all non-null.
if(t instanceof Person) { s = (Student)t; }
最后一句语句的结果是()。。
A.将构造一个 Student 对象; B.表达式是合法的;
C.表达式是错误的; D.编译时正确,但运行时错误。
12.给出下面代码段 D 1) public class Test { 2) int m, n; 3) public Test( ) {} 4)
public Test(int a) { m=a; } 5) public static void main(String arg[]) { 6) Test t1,t2;
7) intj,k; 8) j=0; k=0; 9) t1=new Test( ); 10) t2=new Test(j,k); 11) } 12) }
哪行将引起一个编译时错误?
A.line 3 B.line 5 C.line 6 D.line 10
13.对于下列代码:D
1) class Person {
2) public void printValue(int i, int j) {//... }
3) public void printValue(int i){//... }
4) }
5) public class Teacher extends Person {
6) public void printValue( ) {//... }
7) public void printValue(int i) {//...}
8) public static void main(String args[]){
9) Person t = new Teacher( );
10) t.printValue(10);
11) }
第10行语句将调用哪行语句?()。
A.line 2 B.line 3 C.line 6 D.line 7
14.指出正确的表达式(C )
A.byte=128; B.Boolean=null;
C.long l=0xfffL; D.double=0.9239d;
15.MAX_LENGTH 是 int 型 public 成员变量,变量值保持为常量 100,用简短语句定义这个变
量(D)。。
A.public int MAX_LENGTH=100;
B.final int MAX_LENGTH=100;
C.final public int MAX_LENGTH=100;
D.public final int MAX_LENGTH=100.
16.面向对象程序设计方法的优点(D)。。
A.可重用性、可扩展性、可操作性 B.可重用性、可维护性、可操作性
C.可管理性、可扩展性、可操作性 D.可重用性、可扩展性、可管理性
17.下列哪些语句关于内存回收的说明是正确的? (B )
A.程序员必须创建一个线程来释放内存;
B.内存回收程序负责释放无用内存
C.内存回收程序允许程序员直接释放内存
D.内存回收程序可以在指定的时间释放内存对象
18.要从文件" file.dat"文件中读出第 10 个字节到变量 C 中,下列哪个方法适合? (A )
A.FileInputStream in=new FileInputStream(""file.dat"");in.skip(9);
int c=in.read();
B.FileInputStream in=new FileInputStream(""file.dat"");
in.skip(10);
int c=in.read();
C.FileInputStream in=new FileInputStream(""file.dat"");
int c=in.read();
D.RandomAccessFile in=new RandomAccessFile(""file.dat"");
in.skip(9);
int c=in.readByte();
19.下面哪些选项是正确的 main 方法说明?(B )
A.public main(String args[])
B.public static void main(String args[])
C.private static void main(String args[])
D.void main( )
20.下面哪种注释方法能够支持 javadoc 命令: (D )
A./**...**/ B./*...*/
C.// D./**...*/
21.下列不可作为 java 语言修饰符的是(D)
剩余15页未读,继续阅读
资源评论
雨过朦胧影
- 粉丝: 82
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 夜间灯光数据“合成DMSP(1992-2020)”(年度数据)
- 基于springboot的网上花店系统,包含后端springboot项目、前台(用户角色)和后台管理(管理员/卖家角色)两个前端
- 2022年版本异质机构投资者(压力敏感型和压力抵制型机构投资者)数据2000-2022年
- 【重磅、详细、2022更新!】1990-2022上市公司环境保护税(排污费)数据大合集!
- TVP-SV-VAR方法的MATLAB操作步骤及关键代码解释
- 7607p电信固件V2.0.0P1N6
- 0到180度移相电路Multisim仿真
- 全国水体矢量分省市县合集2023年OSM数据-一二三四五级水系与水系流域shp矢量数据
- 7607p移动固件CMCC-V2.0.6P1N2
- Python3数据分析与挖掘实战:源代码code
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功