网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

补全toString方法,使其内容为“width=***,height=***”。 public class Rectangle{ private double width; private double height; public Rectangle(){} public Rectangle(double a, double b) { width=a;height=b; } public String toString(){ 代码 } }


参考答案和解析
A
更多 “补全toString方法,使其内容为“width=***,height=***”。 public class Rectangle{ private double width; private double height; public Rectangle(){} public Rectangle(double a, double b) { width=a;height=b; } public String toString(){ 代码 } }” 相关考题
考题 ●试题六阅读以下说明和C++程序,将应填入(n)处的语句写在答题纸的对应栏内。【说明】以下程序的功能是计算三角形、矩形和正方形的面积并输出。程序由4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述3种图形面积的通用接口【C++程序】#includeiostream.h#includemath.hclass Figure{public:virtual double getArea()=0:∥纯虚拟函数};class Rectangle: (1) {protected:double height;double width;public:Rectangle(){};Rectangle(double height,double width){this-height=height;this-width=width;}double getArea(){return (2) ;}};class Square: (3) {public:Square(double width){(4) ;}};class Triangle: (5) {double la;double Ib;double lc;public:Triangle(double la,double lb,double lc){This-la=la;this-lb=lb;this-lc=lc;}double getArea(){double s=(la+lb+±c)/2.0;return sqrt(s*(s-1a)*(s-1b)*(s-1c));}};void main(){Figure*figures[3]={new Triangle(2,3,3),new Rectangle(5,8),new SqUare (5) );for (int i=0;i3;i++){cout"figures["i"]area="(figures[i])-getArea()endl;}}

考题 阅读以下说明和Java程序,将应填入(n)处的字句写在对应栏内[说明]以下程序的功能时三角形、矩形和正方形的面积输出。程序由5个类组成:areatest是主类,类Triangle,Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。[Java程序]public class areatest {public static viod main(string args[]){Figure[]Figures={New triangle(2,3,3),new rectangle(5,8),new square(5)};for(int i=0; i<Figures.length;i++){system.out.println(Figures+"area="+Figures.getarea());}}}public abstract class figure {public abstract double getarea();}public class rectangle extends (1) {double height;double width;public rectangle (double height,double width){this.height=height;this.width=width;}public string tostring(){return"rectangle:height="+height+",width="+width+":";}public double getarea(){return (2)}}public class square exends (3){public square(double width){(4);}public string tostring(){return"square:width="+width":";}}public class triangle entends (5){double la;double lb;double lc;public triangle(double la,double lb,double lc){this.la=la;this.lb=lb;this.lc=lc;}public string tostring()(return"triangle:sides="+la+","+lb+","+lc+":";}public double get area(){double s=(la+lb+lc)/2.0;return math.sqrt(s*(s-la)*(s-lb)*(s-lc));}}

考题 阅读以下说明和Java源程序,将应填入(n)处的字句写在对应栏内。【说明】以下程序能够计算三角形、矩形和正方形的周长并输出。程序由5个类组成:AreaTest是主类,类Triangle、Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算周长的抽象方法。【程序】public class girthTest{public static void main (String args[]){Figure[]figures={new Triangle (2,3,3),new Rectangle(5,8),new Square(5)};for(int i=0;i<figures.length;i++){System.out.println(figures[i]+"girth="+figures[i].getGirth());}}}public abstract class Figure{public abstract double getGirth();}public class Rectangle extends (1) {double height;double width;public Rectangle(double height,double width){this.height=height;this.width=width;}public String toString(){return "Rectangle:height="+height+",width="+width+":";}public double getGirth(){return (2);}}public class Square extends (3) {public Square(double width){(4);}public Stdng toString(){return "Square:width='+width+":";}}public class Triangle extends (5) {double la;double lb;double lc;public Triangle(double la,double lb,double lc){this.la=la;this.lb=lb;this.lc=lc;}public String toString(){return "Triangle:sides=" +la+"," +lb+"," +lc+":";}public double getGirth(){return la+lab+lc;}}

考题 阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】下面的程序先构造Point类,再顺序构造Ball类。由于在类Ball中不能直接存取类Point中的xCoordinate及yCoordinate属性值,Ball中的toString方法调用Point类中的toString方法输出中心点的值。在MovingBall类的toString方法中,super.toString调用父类Ball的toString方法输出类Ball中声明的属性值。public class Point{private double xCoordinate;private double yCoordinate;public Point 0 }public Point(ouble x, double y){xCoordinate = x;yCoordinate = y;}public String toString(){return "( + Double.toString(Coordinate)+ ","+ Double.toString(Coordinate) + ");}//other methods}public class Ball{(1); //中心点private double radius; //半径private String colour; ///颜色public Ball() { }public Ball(double xValue, double yValue, double r)// 具有中心点及半径的构造方法{center=(2);//调用类Point 中的构造方法radius = r;}public Ball(double xValue, double yValue, double r, String c)// 具有中心点、半径及颜色的构造方法{(3);//调用3个参数的构造方法colour = c;}public String toString(){return "A ball with center" + center, toString() + ", radius"+ Double.toString(radius) + ", colour" + colour;}//other methods}public class MovingBall. (4){private double speed;public MovingBall() { }public MovingBall(double xValue, double yValue, double r, String e, double s){(5);// 调用父类Ball中具有4个参数的构造方法speed = s;}public String toString( ){ return super, toString( ) + ", speed "+ Double.toString(speed); }//other methods}public class Tester{public static void main(String args[]){MovingBall mb = new MovingBall(10,20,40,"green",25);System.out.println(mb);}}

考题 ( 13 )补充完整下面的类定义:const double PI=3 .14;class Circle{ // 圆形物体的抽象基类protected:double r; // 半径public:Circle ( double radius=0 ) : r ( radius ) {}【 13 】 ; // 计算圆形物体表面积的纯虚函数声明};class Cylinder:public Circle { // 圆柱体类double h; // 高度public:Cylindr ( double radius=0, doubli height=0 ) :Circle ( radius ) , h ( height ) {}Virtual double Area () { // 计算圆柱体的表面积return 2*PI*r* ( r+h ) ;}};

考题 阅读以下说明和C++代码,将应填入(n)处的字句写在对应栏内。【说明】以下C++程序的功能是计算三角形、矩形和正方形的面积并输出。程序由4个类组成:类 Triangle、Rectangle和Square分别表示三角形、矩形和正方形:抽象类Figure提供了一个纯虚函数getAxea(),作为计算上述3种图形面积的通用接口。【C++代码】include<iostream>include<cmath>using namespace std;class Figure{public:virtual double getArea()=0;//纯虚函数};class Rectangle : (1) {protected:double height;double width;public:Rectangle(){}Rectangle(double height, double width){this->height=height;this->width=width;}double getArea(){return (2);}};class Square: (3) {public:Square(double width){(4);}};class Triangle: (5) {private:double la,lb,lc;public:Triangle(double la,double lb,double lc){this->la=la;this->1b=1b;this->lc=lc;}double getArea(){double s=(la+lb+lc)/2.0;return sqrt(s*(s-la)*(s-lb)*(s-lc));}int main(){Figure *figures[3]={new Triangle(2,3,3),new Rectangle(5,8), new Square(5)};for(int i=0;i<3;i++){cout<<"figures["<<i<<"]area="<<(figures[i])->getArea()<<endl;}return 0;}

考题 阅读以下说明和C++程序,将应填入(n)处的语句写在的对应栏内。【说明】以下程序的功能是计算三角形、矩形和正方形的面积并输出。程序由4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述3种图形面积的通用接口。【C++程序】include<iostream.h>include<math.h>class Figure {public:virtual double getArea()=0; //纯虚拟函数};class Rectangle:(1){protected:double height;double width;public:Rectangle() {};Rectangle(double height,double width) {this->height=height;this->width=width;}double getArea() {return (2);}};class Square:(3){public:Square(double width){(4);}};class Triangle:(5){double la;double lb;double lc;Public:Triangle(double la, double lb, double lc) {This->la=la; this->lb=lb; this->lc=lc;}double getArea() {double s = (la+lb+±c)/2.0;return sqrt(s,(s-la)*(s-lb)*(s-Ic));}};void main() {Figure*figures[3]={new Triangle(2,3,3), new Rectangle(5,8), new SqUare(5));for(int i=0;i<3;i++){cout<<"figures["<<i<<"]area="<<(figures[i])->getArea()<<endl;}}

考题 阅读下列C++程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】以下C++程序的功能是计算三角形、矩形和正方形的面积并输出。程序由4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述3种图形面积的通用接口。include<iostream.b>include<math.h>class Figure{public:virtual double getArea0=0; //纯虚拟函数};class Rectangle: (1) {protected:double height;double width;public:Rectangle(){};Rectangle(double height, double width){This->height=height;This->width=width;}double getarea(){return (2);}};class Square: (3) {public:Square(double width){(4);}};class Triangle: (5) {double la;double lb;double lc;public:Triangle(double la, double lb, double lc){this->la=la; this->lb; this->lc;}double getArea(){double s=(la+lb+lc)/2.0;return sqrt(s*(s-la)**(s-lb)*(s-lc));}};viod main(){Figure* figures[3]={new Triangle(2,3,3), new Rectangle(5,8), new Square(5));for(int i=0;i<3;i++){cout<<"figures["<<i<<"]area="<<(figures[i])->getarea()<<endl;}}

考题 阅读以下函数说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1,y1,x2,y2)画一条直线,DP2则用drawline(x1,x2,y1,y2)画一条直线。当实例画矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图9-6显示了各个类间的关系。这样,系统始终只处理3个对象:Shape对象、Drawing对象、DP1或DP2对象。以下是 Java语言实现,能够正确编译通过。【Java代码】//DP1.java文件public class DP1{static public void draw_a line(double x1,double y1,double x2,double y2){//省略具体实现}}//DP2.java文件public class DP2{static public void drawline(double x1,double y1,double x2,double y2){//省略具体实现}}//Drawing.java文件(1) public class Drawing{abstract public void drawLine(double x1, double y1, double x2, double y2);}//V1Drawing.java文件public class V1Drawing extends Drawing{public void drawLine(double x1, double y1, double x2, double y2){DP1.draw_a_line(x1,y1,x2,y2);}}//V2Drawing.java文件public class V2Drawing extends Drawing{public void drawLine(double x1,double y1,double x2, double y2)(//画一条直线(2);}}//Shape.java文件abstract public class Shape{abstract public void draw();private (3) _dp;Shape(Drawing dp){_dp=dp;}protected void drawLine(double x1,double y1,double x2, double y2){(4);}}//Rectangle.java文件public class Rectangle extends Shape{private double_x1,_x2,_y1,_y2;public Rectangle(Drawing dp,double x1,double y1,double x2,double y2){(5);_x1=x1;_x2=x2;_y1=y1;_y2=y2;}public void draw(){//省略具体实现}}

考题 阅读以下函数说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】下面的程序先构造Point类,再顺序构造Ball类。由于在类Ball中不能直接存取类Point中的xCoordinate及yCoordinate属性值,Ball中的toString方法调用Point类中的toStrinS方法输出中心点的值。在MovingBsll类的toString方法中,super.toString调用父类Ball的toString方法输出类Ball中声明的属性值。【Java代码】//Point.java文件public class Point{private double xCoordinate;private double yCoordinate;public Point(){}public Point(double x,double y){xCoordinate=x;yCoordinate=y;}public String toStrthg(){return"("+Double.toString(xCoordinate)+","+Double.toString(yCoordinate)+")";}//other methods}//Ball.java文件public class Ball{private (1);//中心点private double radius;//半径private String color;//颜色public Ball(){}public Ball(double xValue, double yValue, double r){//具有中心点及其半径的构造方法center=(2);//调用类Point中的构造方法radius=r;}public Ball(double xValue, double yValue, double r, String c){//具有中心点、半径和颜色的构造方法(3);//调用3个参数的构造方法color=c;}public String toString(){return "A ball with center"+center.toString()+",radius "+Double.toString(radius)+",color"+color;}//other methods}class MovingBall (4) {private double speed;public MovingBall(){}public MoyingBall(double xValue, double yValue, double r, String c, double s){(5);//调用父类Ball中具有4个参数的构造方法speed=s;}public String toString(){return super.toString()+",speed"+Double.toString(speed);}//other methods}public class test{public static void main(String args[]){MovingBall mb=new MovingBall(10,20,40,"green",25);System.out.println(mb);}}

考题 如下程序声明了一个二维图形类TwoDShape,从其派生出矩形类Rec。 include include 如下程序声明了一个二维图形类TwoDShape,从其派生出矩形类Rec。include<iostream>include<string>using namespaee std,class TwoDShape{// 二维图形类char name[20];public:TwoDShape (char * n="unknown") {strcpy(name, n);}Char * getName(){return name;}【 】=0;};class Rec: public TwoDShape{double width, heightpublic:Rec(double w-=0. 0,double h=0. 0):TwoDShape("rectangle"){ width=w; height=h; }double getWidth() {return width;}double getHeight() {return height;}double area() {return width * height;}};int main() {TwoDShape * shape;Shape=new Rec(2.1,3.0);cout<<"object is"<<shape->getName()<<"\n";cout<<"Area is"<<shape->area()<<"\n";return 0}请将程序补充完整,使程序在运行时输出:abject is triangleArea is 6.3

考题 下列程序的执行结果为【 】。include class Point{public:Point(double i, double j) 下列程序的执行结果为【 】。include <iostream. h>class Point{public:Point(double i, double j) { x=i; y=j;}double Area() const { return 0.0;}private:double x, y;};class Rectangle: public Point{public:Rectangle(double i, double j, double k, double 1)double Area() const {return w * h;}private:double w, h;};Rectangle: :Rectangle(double i, double j, double k. double 1): Point(i,j).{w=k, h=1}void fun(Point s){cout<<s. Area()<<end1;}void main( ){Rectangle rec(3.0, 5.2, 15.0. 25.0);fun(rec)}

考题 下列选项成员变量声明正确的是A.public protected final int i;B.abstract class F1{…}C.private double height;D.double weight{}

考题 阅读以下说明和JAVA 2代码,填入(n)处的。[说明]以下JAVA程序实现了在接口interface iShape2D的定义和应用,仔细阅读代码和相关注释,将程序补充完整。[代码6-1]interface iShape2D //定义接口{(1)(2)}(3)//实现CRectangle类{int width, height;(4) CRectangle (int w,int h) {width=w;height=h;}public void area ( ){ //定义area( )的处理方式System. out.println ("area="+width*height);}}(5)//实现CCircle类{double radius;(6) CCircle (double r) {radius=r;}public void area ( ) { //定义area( )的处理方式System.out.println ("area="+pi*radius*radius);}}[代码6-2]public class app10_4{public static void main(String args[]){CRectangle rect=new CRectangle (5,10);rect.area ( ); //调用CRectangle类里的area ( ) methodCCircle cir=new CCircle (2.0);cir.area ( ); //调用CCircl类里的area ( ) method}}

考题 下列成员变量声明中,正确的是______。A.public protected final int i;B.abstract class F1{…}C.private double height;D.double weight

考题 下列选项成员变量声明正确的是( )。A.public protected final int i;B.abstract class Fl{…}C.private double height;D.double weight

考题 下列程序中,先声明一个圆类circle和一个桌子类table,另外声明一个圆桌类roundtable,它是由 circle和table两个类派生的,要求声明一个圆桌类对象,并输出圆桌的高度,面积和颜色。请填空完成程序include<iostream.h>include<string.h>class circle{double radius;public:circle(double r){radius=r;}double get_area(){return 3.416*radius*radius;}};class table{double height;public:table(double h)<height=h;}double get_height(){return height;}};class roundtable:public table,public circle{char *color;public:roundtable(double h,double r,char c[]): 【 】 {color=new char[strlen(c) +1];【 】;};char*get_color(){return color;}}:void main(){roundtable rt(0.8,1.0,“白色”);cout<<"圆桌的高:"<<rt. get_height()<<end1;cout<<"圆桌面积:"<<rt.get_area()<<end1;cout<<"圆桌颜色:"<<n.get color()<<end1;}

考题 本题的功能是监听鼠标的操作。鼠标置于窗口中单击时(左键或右键),在单击的地方会画一个小矩形,如果将鼠标置于小矩形上,则鼠标光标状态改为小十字,按下鼠标左键可拖曳,双击鼠标左键(或右键)时,小矩形消失。 import java.awt.*; import java.awt.event.*; import java.util.*; import java.awt.geom.*; import javax.swing.*; public class java3 { public static void main(String[]args) { MouseFrame. frame=new MouseFrame: frame.setDefaultCloseOperation(JFrame.EXIT_ oN_CLOSE); frame.show; } } class MouseFrame. extends JFrame { public MouseFrame { setTitle("java3"); setSize(DEFAULT WIDTH, DEFAULT HEIGHT): MousePanel panel=new MousePanel; Container contentPane=getContentPane; contentPane.add(panel); } public static final int DEFAULT_WIDTH=300; public static final int DEFAULT_HEIGHT=200; } class MousePanel extends JPanel { public MousePanel { squares=new ArrayList; current=null: addMouseListener(new MouseHandler); addMouseMotionListener(new MouseMotionHan- dler); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2=(Graphics2D)g; for(int i=0;isquares.size;i++) g2.draw((Rectangle2D)squares.get(i)); } public void find(Point2D p) { for(int i=0;isquares.size;i++) { Rectangle2D r=(Rectangle2D)squares.get(i); if(r.contains(p))return r; } return null: } public void add(Point2D p) { double x=P.getX; double Y=P.getY: current=new Rectangle2D.Double( x-SIDELENGTH/2. y-SlDELENGTH/2. S1DELENGTH, SIDELENGTH); squares.add(current); repaint; } public void remove(Rectangle2D s) { if(S= =null)return: if(S= =current)current=null; squares.remove(s): repaint; } private static final int SIDELENGTH=10: private ArrayList squares; private Rectangle2D current; private class MouseHandter extends MouseAction- Listener { public void mousePressed(MouseEvent event) { current=find(event.getPoint); if(current= =null) add(event.getPoint); } public void mouseClicked(MouseEvent event) { current=find(event.getPoint); if(current!=nullevent.getClickCount =2) remove(current); } } private class MouseMotionHandler implements Mouse- MotionListener { public void mouseMoved(MouseEvent event) { if(find(event.getPoint)= =null) setCursor(Cursor.getDefaultCursor); else setCursor(Cursor.getPredefinedCursor (Cursor.CROSSHAIR_CURSOR)); } public void mouseDragged(MouseEvent event) { if(current!=null) { int x=event.getX: int Y=event.getY; 、 current.setFrame( x-SIDELENGTH/2, Y-SlDELENGTH/2. SIDELENGTH, SIDELENGTH); repaint; } } } }

考题 阅读以下说明和c++代码,将应填入(n)处的字句写在对应栏内。【说明】现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1, y1,x2,y2)画一条直线,DF2则用drawline(x1,x2,y1,y2)画一条直线。当实例画矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现 部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图9-7显示了各个类间的关系。这样,系统始终只处理3个对象:Shape对象、Drawing对象、DP1或DP2对象。以下是 C++语言实现,能够正确编译通过。【C++代码】class DP1{public:static void draw_a_line(double x1, double y1,double x2, double y2){//省略具体实现});class DP2{public:static void drawline(double x1, double x2,double y1, double y2){//省略具体实现}};class Drawing{public:(1) void drawLine(double x1,double y1,double x2,double y2)=0;};class V1Drawing:public Drawing{public:void drawLine(double x1, double y1,double x2, double y2){DP1::draw_a_line(x1,y1,x2,y2);}};class V2Drawing:public Drawing{public:void drawLine(double x1, double y1, double x2, double y2){(2);}};class Shape{private:(3) _dp;public:Shape(Drawing *dp);virtual void draw()=0;void drawLine(double x1, double y1, double x2, double y2);};Shape::Shape(Drawing *dp){_dp = dp;}void Shape::drawLine(double x1, double y1, double x2, double y2){ //画一条直线(4);}class Rectangle: public Shape{private:double _x1,_y1,_x2,_y2;public:Rectangle(Drawing *dp, double x1, double y1,double x2, double y2);void draw();};Rectangle::Rectangle(Drawing *dp, double x1, double y1, double x2, double y2):(5){_x1=x1;_y1=y1;_x2=x2;_y2=y2;}void Rectangle::draw(){//省略具体实现}

考题 有如下两个类定义: class XX{ private: double xl; protected: double x2; public: double x3; }; class YY:protected XX{ private: double yl; protected: double y2; public: double y3; 在类YY中保护成员变量的个数是( )。A.1B.2C.3D.4

考题 请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。[题目要求]生成下面左边图形界面,单击图中的New按钮,弹出如右图所示的对话框。源程序:import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Java_3 {public static void main(String[] args) {MulticastFrame. frame=new MulticastFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.show();}}class MulticastFrame. extends JFrame. {public MulticastFrame() {setTitle("MulticastTest");setSize(WIDTH,HEIGHT);MulticastPanel panel=new MulticastPanel();Container contentPane=getContentPane();contentPane.add( (1) );}public static final int WIDTH=300;public static final int HEIGHT=200;}class MulticastPanel extends JPanel }public MulticastPanel() {JButton newButton=new JButton("New");add(newButton);ActionListener newListener=new ActionListener() {public void actionPerformed(ActionEvent event) {makeNewFrame();}};newButton.addActionListener(newListener);closeAllButton=new JButton("Close all");add(closeAllButton);}private void makeNewFrame() {final BlankFrame. frame=new BlankFrame();frame.show();ActionListener closeAllListener=new ActionListener() {public void actionPerformed(ActionEvent event) {frame. (2) (); //使窗口隐藏或消除}};closeAllButton.addActionListener( (3) );}private JButton closeAllButton;}Class BlankFrame. extends JFrame. {public BlankFrame() {(4) ++;setTitle("Frame"+counter);setSize(WIDTH,HEIGHT);setLocation(SPACING*counter,SPACING*counter);}public static final int WIDTH=200;public static final int HEIGHT=150;public static final int SPACING=30;private static int counter=0;}

考题 public class OuterClass {  private double d1  1.0;  //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?() A、 static class InnerOne {  public double methoda() {return d1;}  }B、 static class InnerOne {  static double methoda() {return d1;} }C、 private class InnerOne {  public double methoda() {return d1;} }D、 protected class InnerOne {  static double methoda() {return d1;} }E、 public abstract class InnerOne {  public abstract double methoda();  }

考题 Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

考题 1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()  A、 static class InnerOne { public double methoda() { return d1; } }B、 static class InnerOne { static double methoda() { return d1; } }C、 private class InnerOne { public double methoda() { return d1; } }D、 protected class InnerOne { static double methoda() { return d1; } }E、 public abstract class InnerOne { public abstract double methoda(); }

考题 Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?()  A、The rectangle drawn will have a total width of 5 pixels.B、The rectangle drawn will have a total height of 6 pixels.C、The rectangle drawn will have a total width of 10 pixels.D、The rectangle drawn will have a total height of 11 pixels.

考题 单选题Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?()A The rectangle drawn will have a total width of 5 pixels.B The rectangle drawn will have a total height of 6 pixels.C The rectangle drawn will have a total width of 10 pixels.D The rectangle drawn will have a total height of 11 pixels.

考题 多选题1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()Astatic class InnerOne { public double methoda() { return d1; } }Bstatic class InnerOne { static double methoda() { return d1; } }Cprivate class InnerOne { public double methoda() { return d1; } }Dprotected class InnerOne { static double methoda() { return d1; } }Epublic abstract class InnerOne { public abstract double methoda(); }

考题 多选题public class OuterClass {   private double d1 1.0;   //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()Astatic class InnerOne {  public double methoda() {return d1;}  }Bstatic class InnerOne {  static double methoda() {return d1;}  }Cprivate class InnerOne {  public double methoda() {return d1;}  }Dprotected class InnerOne {  static double methoda() {return d1;}  }Epublic abstract class InnerOne {  public abstract double methoda();  }