java笔试题5
更新时间:2024-01-05 03:33:01 阅读量: 教育文库 文档下载
- java笔试题大全带答案推荐度:
- 相关推荐
1、下列代码的输出结果:
public class test09 {
public static void main(String[] args) { Super s = new Sub(); s.test(); } }
class Super{
public void test(){ this.t();this.g(); }
public void t(){System.out.println(\);} private void g(){System.out.println(\);} }
class Sub extends Super{
public void t(){System.out.println(\);} private void g(){System.out.println(\);} }
A.Sub.t(); Sub.g(); B.Sub.t(); Super.g(); C.Super.t(); Super.g(); D.Super.t(); Sub.g(); 答案:B
2、下列代码的输出结果是: abstract class Vehicle{ public int speed(){ return 0; } }
class Car extends Vehicle{ public int speed(){ return 60; } }
class RaceCar extends Car{ public int speed(){ return 150; }
}
public class TestCar { public static void main(String[] args) { RaceCar racer = new RaceCar(); Car car = new RaceCar(); Vehicle vehicle = new RaceCar(); System.out.print(racer.speed()+\ +vehicle.speed()); } } A.0,0,0
B.150,60,0 C.150,150,150
D.抛出运行时异常 答案:C
3、下列代码运行的结果是: public class Hello { String title; int value;
public Hello(){ title +=\ }
public Hello(int value){ this.value = value; title =\ }
public static void main(String[] args) { Hello c = new Hello(5); System.out.println(c.title); } }
A.Hello
B.Hello World C.Hello World 5 D.运行后无输出 答案:A
4、执行下列语句: int a = 0x9af700; a <<= 2;
变量a的值为:()。 A. 0x26bdc00 B. B. 0xc6bdc00
C. 0x3fa0000 D. 0x7e02ffff 答案:A
5、下列语句创建对象的总个数是:()。 String s=”a”+”b”+”c”+”d”; A. 1 B. 2 C. 3 D. 4 答案:A.
6、类A,B的定义如下: class A {
private int a = 100; A() {
System.out.print(\ System.out.println(a); } }
class B extends A { private int a = 200; B() {
System.out.print(\ System.out.println(a); } }
运行下面的代码: new B();
输出的结果是:()。 A. A() 100
B() 200 B. A() 200
B() 200 C. B() 200
A() 100 D. B() 200
A() 200
7、下列不属于Java运算符的是()。 A.!= B.<> C.>>
D.<< E.>>> F.<<<
正确答案:BF
8、下列属于不合法Java标识符的是()。 A._avaj B.5save C.Avaj5 D.$80
正确答案:B
9、运行下列程序:
String str = \String str1 = \int index = 0;
while ((index = str.indexOf(str1, index)) != -1) { System.out.print(index+””); index += str1.length(); }
控制台输出的结果是:()。 A.1 10 21 B.2 11 22 C.3 13 23 D.5 13 22 正确答案:B
10、class Card{}下列不属于Card类构造方法的是:() A.Card(){}
B.public Card(){}
C.public void Card(){} D.private Card(){} 正确答案:C
11、 以下程序的输出结果是: ()。 public class Super { public Super() {
System.out.println(\ } }
public class Sub extends Super{ public Sub() {
System.out.println(\ }
public static void main(String[] args) { Super fc = new Super(); Sub cc = new Sub(); } }
A.Super Super Sub B.Super Sub C.Sub Super D.Super Sub Sub
正确答案:A
12、A类中有一个方法:protected int print(String str){},B类继承A类,以下方法能在B类中重写A类中print()方法的是: ()。 A.public int print(String str){} B.private int print(String str){} C.private void print(String str){} D.public void print(String str){} 正确答案:A
13、运行下面的语句: String s=\if(s==s+0){
System.out.println(\}
编译,运行的结果是:()。 A.Hello World B.无输出
正在阅读:
java笔试题501-05
第7课 物品上的花廊09-23
2017-2022年中国纤维素酶行业分析与投资机遇预测报告(目录)10-05
2022年幼儿园卫生保健工作总结03-20
DNA提取的操作07-09
C语言第5章循环结构04-09
苏教版二年级语文上册复习资料02-28
凯茵小学(英语学科)五年级知识竞赛试题01-31
设计单位规章制度02-26
关于读书的作文500字共5篇12-27
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 试题
- java
- 2017-2022年中国文具行业市场供需预测研究报告(目录) - 图文
- 《我的人生》写作 - 图文
- 2018届中考数学专题复习《相似三角形》同步练习(有答案)
- 最新-江苏省盐城市阜宁县明达初级中学2018学年七年级英语下册 Unit7-Unit9 测试题 牛津版 精品
- 痛风患者可以泡温泉吗
- 外架拆除安全旁站监理记录表
- 综治宣传月活动方案
- 报关期末复习
- 《中国现代文学专题》期末复习题及答案(第一部分)
- 浅谈《现代信号处理》课程教学-精品文档
- 高中英语必修一第五单元
- 人教版小学语文三年级上册《赵州桥》课堂实录
- 工程材料实验指导手册
- 微型数控车床使用说明书(2008-05-18)
- 跨文化交际课后题答案
- 教师安全会议记录资料 - 图文
- 2018 - 2019学年高中物理第十章热力学定律第3节热力学第一定律能量守恒定律课后课时精练新人教版选
- GB50210建筑装饰装修工程施工质量验收规范
- ISO13485:2016设计和开发控制程序
- 管理学期末考试A卷