题海
让大学四年没有难题
首页
搜题
登陆
题目详情
单选题
下列选项中,不属于代码块的是()
A.
普通代码块
B.
动态代码块
C.
同步代码块
D.
构造块
查看答案
学科:
默认课程
时间:
2025-12-09 15:04:23
相关题目
相关作业
题目1
单选题
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?( ) class Tom { int x; static int y; void showXY(){ System.out.printf("%d,%d\n",x,y); } static void showY() { System.out.printf("%d\n",y); } } public class E { public static void main(String aqgs[]){ Tom.y = 100; //【1】 Tom cat = new Tom(); cat.x = 100; cat.y = 200; //【2】 Tom.x = 300; //【3】 cat.showXY(); Tom.showY(); //【4】 } }
A. 【1】
B. 【4】
C. 【2】
D. 【3】
题目2
单选题
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?( ) class Tom { private int x = 120; protected int y = 20; int z = 11; private void f() { x = 200; System.out.println(x); } void g() { x = 200; System.out.println(x); } } public class E { public static void main(String args[]) { Tom tom = new Tom(); tom.x = 22; //【1】 tom.y = 33; //【2】 tom.z = 55; //【3】 tom.g(); //【4】 } }
A. 【2】
B. 【4】
C. 【1】
D. 【3】
题目3
单选题
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?( ) public class Animal //【1】 {} private class Dog //【2】 {} class Cat //【3】 {} class _class //【4】 {}
A. 【3】
B. 【1】
C. 【2】
D. 【4】
题目4
单选题
下列哪个叙述是正确的?( )
A. 源文件可以有2条包语句(package)
B. 源文件不可以有多条import语句
C. 类中的类方法(static方法)只能操作类变量(static变量),不可以操作实例变量
D. 如果源文件有package语句,该语句也可以是源文件的第2条语句
题目5
单选题
下列哪个叙述是正确的?( )
A. 局部变量也可以用访问修饰符:public,proteced,private修饰
B. 成员变量有默认值
C. 类中的实例方法可以用类名调用
D. this可以出现在static方法中
题目6
单选题
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?( ) class Tom { private int x = 120; protected int y = 20; int z = 11; private void showX() { System.out.println(x); } public void setX(int x) { this.x = x; System.out.println(x); } } public class E { public static void main(String args[]) { Tom tom = new Tom(); tom.setX(22); //【1】 tom.y = 33; //【2】 tom.z = 55; //【3】 tom.showX(); //【4】 } }
A. 【3】
B. 【2】
C. 【1】
D. 【4】
题目7
单选题
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?( ) class Cat { int leg; static int water; void setLeg(int leg) { this.leg = leg; //【1】 this.water = 100; //【2】 } static void setWater(int water) { this.water = water; //【3】 Cat.water = water; //【4】 } }
A. 【3】
B. 【4】
C. 【1】
D. 【2】
题目8
单选题
下列选项中,不属于代码块的是()
A. 普通代码块
B. 动态代码块
C. 同步代码块
D. 构造块
题目9
单选题
假设满足访问权限的前提下,下列关于实例方法和静态方法的说法中,错误的是( )
A. 静态方法能直接引用静态变量
B. 静态方法能直接引用实例变量
C. 实例方法能直接引用实例变量
D. 实例方法能直接引用静态变量
题目10
单选题
下列哪些类(不包括内部类)声明是错误的?( )
A. class a
B. private class A
C. public class A
D. class A
下载
题海APP
拍照搜题更快捷
海量题库
无搜索限制
快捷拍照搜题
扫描他!然后带走我~