java选择题-变量重名用哪个关键字

}catch(Exception e){

System.out.println(\语句块执行\ return; }finally{

System.out.println(\语句块执行\ }

System.out.println(\程序继续向下执行\ } }

运行以上程序,输出的结果是( ) A、catch语句块执行

B、catch语句块执行 程序继续向下执行 C、catch语句块执行 finally语句块执行 D、0 程序继续向下执行 156、请阅读下面的程序 public class Example03 {

public static void main(String[] args) { int x = 8; if (x > 5) {

System.out.println(\ } else {

System.out.println(\ } } }

程序的运行结果是?() A、true B、false C、a D、b

157、当成员变量和局部变量重名时,若想在方法内使用成员变量,那么需要使用下列选项中的哪一个关键字( )。 A、super B、import C、this D、return

158、下列关于Java语言的描述中,错误的是?() A、Java语言是一门面向对象的编程语言 B、Java是一门与平台无关的编程语言

C、Java具有JavaSE、JavaME和JavaEE三大平台 D、Java是一门介于汇编和高级之间的语言

159、下面关于字符变量的定义中,错误的是( ) A、char a='a'; B、char b=97;

C、char c=0x61; D、char d=A;

160、下列关于continue语句的说法中,正确的是 A、continue语句可以在选择语句中使用 B、continue语句可以在条件语句中使用 C、continue语句可以在循环语句中使用 D、continue语句可以在任何语句中使用 161、请阅读下面的程序片段 int x = 1, y = 1;

if (x++ == 2 & ++y == 2) { x = 7; }

System.out.println(\

程序的运行结果是( ) A、x=1,y=1 B、x=7,y=1 C、x=7,y=2 D、x=2,y=2

162、下列方法中,哪个方法可以返回指定日历字段的值?()A、void add(int field,int amount) B、void set(int field,int value) C、int get(int field)

D、void set(int year,int month,int date)

163、下了关于接口继承的说法中,正确的是?() A、接口继承自Object类

B、一个接口只能继承一个接口 C、一个接口可以继承多个接口 D、接口不能被继承

164、float类型成员变量的默认初始化值是( )。 A、0 B、false C、null D、0.0F

165、分析下面程序,哪一行代码能正确赋值?() class Demo {

public void method() {

final int num1 = 10; static int num2 = 20; abstract int num3 = 30; private int num4 = 40; } }

A、final int num1 = 10; B、static int num2 = 20;

C、abstract int num3 = 30; D、private int num4 = 40;

166、下列关于条件语句的描述,错误的是( ) A、if语句中的条件表达式是一个布尔值

B、选择语句分为if条件语句和switch条件语句 C、switch语句中的表达式只能是布尔类型的值 D、switch语句只能针对某个表达式的值作出判断

167、下列选项中,按照箭头方向,不可以进行自动类型转换的是 A、byte → int B、int → long C、double →long D、short → int

168、下列选项中,按照箭头方向,需要进行强制类型转换的是 A、double ← float B、float ← long C、int ← char D、char ←byte

169、Calendar类中,用于为指定的日历字段增加或减去指定的时间量的方法是?( ) A、int get(int field)

B、void add(int field,int amount) C、void set(int field,int value)

D、void set(int year,int month,int date) 170、请阅读下面的程序 Public class Test {

public static void main(String[] args) { int a = 0; int b = 0;

for (int i = 1; i <= 5; i++) { a = i % 2;

while (a-- >= 0) { b++; } }

System.out.println(\} }

下列选项中,哪一个是正确的运行结果( ) A、a=8,b=-2 B、a=-2,b=8 C、a=3,b=0 D、a=0,b=3

171、下列关于继承的描述中,错误的是()

A、在Java中,类只支持单继承,不允许多重继承,也就是说一个类只能有一个直接父类 B、多个类可以继承一个父类

C、在Java中,多层继承是可以的,即一个类的父类可以再去继承另外的父类,例如C类继承自B类,而B类又可以去继承A类,这时,C类也可称作A类的子类 D、Java是支持多继承的

172、下面的程序段执行后,输出的结果是以下哪个选项? StringBuffer buf=new StringBuffer(\ buf.insert(7,\

System.out.println(buf.toString()); A、Beijing@2008 B、@Beijing2008 C、Beijing2008@ D、Beijing#2008

173、下列关于接口的说法中,错误的是?( ) A、接口中定义的方法默认使用\来修饰 B、接口中的变量默认使用\来修饰 C、接口中的所有方法都是抽象方法 D、接口中定义的变量可以被修改 174、请阅读下面的代码片段 public static int add(int a,int b) { return a + b; }

下列选项中,可以在main()方法中成功调用add()方法的是 A、int num = add(1.0,2.0); B、int num = add('a','b'); C、int num = add(true,flase); D、int num = add(\

175、jar命令解压缩jar文件,需要的参数是( ) A、c B、v C、x D、f

176、SimpleDateFormat类的哪个方法可以格式化日期?() A、format B、parse C、toString D、equals

177、请阅读下面的程序代码 Class Person{ void say(){

System.out.println(“hello”); } }

class Example{

public static void main(String[] args){ Person p2 = new Person();

Person p1 = new Person(); p2.say(); p1.say(); p2=null; p2.say(); } }

下列关于程序运行结果的描述中,正确的是() A、输出1个hello

B、输出2个hello后会抛出异常 C、输出3个hello后会抛出异常 D、不会输出hello,直接抛出异常 178、下列程序运行结果是( ) public class Demo {

public static void main(String[] args) { Object obj=new Father(){ public void show(){

System.out.println(\ } };

obj.show(); } }

class Father{

public void show(){

System.out.println(\ } }

A、hello father B、helloworld C、无结果

D、程序编译报错

179、下列目录中,哪一个是用来存放JDK可执行程序的。(A、db目录 B、jre目录 C、lib目录 D、bin目录

180、请阅读下面的程序 public class Test {

public static void main(String[] args) { int m = 37; int n = 13;

while (m != n) { while (m > n) {

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4