java复习题江西科技学院(6)
Random rd = new Random(); ArrayList allNum = new ArrayList(); Integer result[] = new Integer[5]; int x; for (int i = 1; i <= 26; i++) { allNum.add(new Integer(i)); } for (int i = 0; i < 5; i++) { x = ; result[i] = (Integer) allNum.get(x); allNum.remove(x); } for (int i = 0; i < result.length; i++) { System.out.print(result[i] + \ \ } } }
15. 下面程序段执行后b的值是 。 Integer integ =new Integer(9); boolean b = integ instanceof Object;
16. 应用程序TiMu2.java的源程序如下,运行该应用程序,输出结果为:public class TiMu2 { public static void main(String[] args) { String s = \ int x = s.indexOf(\ int y = s.indexOf(\ int z = s.indexOf(\ String s2 = s.substring(z + 1); System.out.println(s2); }}
17. 应用程序TiMu3.java的源程序如下,运行该应用程序,输出结果为:public class TiMu3 { private static int num = 100; public static void main(String args[]) { TiMu3 tm1 = new TiMu3(); TiMu3.num++; tm1.num++; TiMu3 tm2 = new TiMu3(); tm2.num++; tm1 = new TiMu3(); TiMu3.num--; tm1.num++;
___________。___________。 System.out.println(\ }}
18. 应用程序Test.java的源程序如下,在命令行键入:
java Test hello everybody how are you
则输出的结果是_______________________________________。 public class MyTest { public static void main(String args[]) { int num1 = args.length; int num2 = args[1].length(); System.out.print(num1 + \ }}
19. 观察下面的程序片断,填写空白处。 class SuperClass { int data;
void setData(int newData) { this.data = newData; }
int getData() {
return this.data; } }
class SubClass ____ SuperClass { int suhData;
void setSubData(int newData) { this.suhData = _____ ; }
int getData() {
return this.suhData; } }
20. 以下程序的输出结果为________________________________________。 public class Person { String name; int age;
public Person(String name, int age) { this.name = name; this.age = age; }
public static void main(String[] args) {
Person c = new Person(\
System.out.println(c.name+\ } }
21. 以下程序的输出结果为___________________________________。 import java.io.*; public class abc {
public static void main(String args[]) {
AB s = new AB(\ System.out.println(s.toString()); } }
class AB { String sl; String s2;
public AB(String str1, String str2) { sl = str1; s2 = str2; }
public String toString() { return sl + s2; } }
22. 以下程序段的输出结果为__________________________________。 import java.util.Arrays;
public class TestArray {
public static void main(String args[]) { int i, j; int a[] = { 5, 9, 7, 8, 6 }; Arrays.sort(a);
for (i = 0; i < a.length; i++)
System.out.print(a[i] + \ System.out.println(); } }
23. 下列代码的执行结果是__________________________。 public class Test {
public static void main(String args[]) { System.out.print(100 % 3); System.out.print(\
System.out.println(100 % 3.0); } }
24. 下列程序的执行结果是_______________________。 public class Test1 {
public static void main(String[] args) { int a = 4, b = 6, c = 8; String s = \
System.out.println(a + b + s + c); } }
四、程序设计题
1. 输入任意一个正整数,判断它是不是回文数。即12321是回文数,个位与万位相同,十 …… 此处隐藏:642字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [实用模板]第八章:法国“新浪潮”与“左岸派”
- [实用模板]2021年北京上半年临床医学检验技师生物
- [实用模板]SAP GUI 7.10客户端安装配置文档
- [实用模板]2001年临床执业医师资格考试综合笔试试
- [实用模板]36机场工作实用英语词汇总结
- [实用模板](一)社会保险稽核通知书
- [实用模板]安全教育主题班会材料
- [实用模板]濉溪县春季呼吸道传染病防控应急演练方
- [实用模板]长沙房地产市场周报(1.30-2.3)
- [实用模板]六年级数学上册典中点 - 图文
- [实用模板]C程序设计(红皮书)习题官方参考答案
- [实用模板]中国证监会第一届创业板发行审核委员会
- [实用模板]桥梁工程复习题
- [实用模板]2011学而思数学及答案
- [实用模板]初中病句修改专项练习
- [实用模板]监理学习知识1 - 图文
- [实用模板]小机灵杯四年级试题
- [实用模板]国贸专业毕业论文模板
- [实用模板]教育学概论考试练习题-判断题4
- [实用模板]2015届高考英语一轮复习精品资料(译林
- 00Nkmhe_市场营销学工商管理_电子商务_
- 事业单位考试法律常识
- 诚信教育实施方案
- 吉大小天鹅食品安全检测箱方案(高中低
- 房地产销售培训资料
- 高一地理必修1复习提纲
- 新概念英语第二册lesson_1_练习题
- 证券公司内部培训资料
- 小学英语时间介词专项练习
- 新世纪英语专业综合教程(第二版)第1册U
- 【新课标】浙教版最新2018年八年级数学
- 工程建设管理纲要
- 外研版 必修一Module 4 A Social Surve
- Adobe认证考试 AE复习资料
- 基于H.264AVC与AVS标准的帧内预测技术
- 《食品检验机构资质认定管理办法》(质
- ABB变频器培训课件
- (完整版)小学说明文阅读练习题及答案
- 深思洛克(SenseLock) 深思IV,深思4,深
- 弟子规全文带拼音




