下面代码中,没有定义内部类或者错误定义了内部类的是()。
A: public Class Line { int length; Class Point {//内部类代码}}
B: public Class Line { public Point getPoint() { return new Point(){//内部类代码}; }}
C: public Class Line { //外部类代码} Class Point {//内部类代码}
D: public Class Line { public int calcLength() { Class Point {//内部类代码} }}
A: public Class Line { int length; Class Point {//内部类代码}}
B: public Class Line { public Point getPoint() { return new Point(){//内部类代码}; }}
C: public Class Line { //外部类代码} Class Point {//内部类代码}
D: public Class Line { public int calcLength() { Class Point {//内部类代码} }}
举一反三
- 下列代码中: class Point{ int x,y; public: Point(int a, int b=0); //① Point(Point &aPoint); //②Point(Point *p); //③ 默认的构造函数是 A: ① B: ② C: ③ D: 没有
- 下列哪些类(不包括内部类)声明是错误的? A: class A B: public class A C: protected class A D: class a
- 下列类的定义,错误的是 A: public class test extends Object{…… } B: final class operators{……} C: class Point{…… } D: void class Point{…… }
- (6-1)下列错误的类定义是() A: public class test extends Object{ ... } B: final class operators{ ... } C: class Point{ ... } D: void class Point{ }
- class Person {private int a;public int change(int m){ return m; }}public class Teacher extends Person {public int b;public static void main(String arg[]){Person p = new Person();Teacher t = new Teacher();int i;// point x}}在 // point x安排哪个语句合法?