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

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

( 24 )阅读下面程序

import javax.swing.JOptionPane;

public class BreakLabelTest {

public static void main( String args[] ){

String utput = "";

stop: {

for ( int row = 1; row <= 10; row++ ) {

for ( int column = 1; column <= 5 ; column++ ) {

if ( row == 5 )

break stop;

output += "* ";

}

output += "\n";

}

output += "\nLoops terminated normally";

}

JOptionPane.showMessageDialog(

null, output," 用一个标志测试 break 语句 ",

JOptionPane.INFORMATION_MESSAGE );

System.exit( 0 );

}

}

程序运行结果是

A )窗口中有 5 行 * * * * *

B )窗口中有 5 行 * * * *

C )窗口中有 4 行 * * * * *

D )窗口中有 6 行 * * * * *


参考答案

更多 “ ( 24 )阅读下面程序import javax.swing.JOptionPane;public class BreakLabelTest {public static void main( String args[] ){String utput = "";stop: {for ( int row = 1; row = 10; row++ ) {for ( int column = 1; column = 5 ; column++ ) {if ( row == 5 )break stop;output += "* ";}output += "\n";}output += "\nLoops terminated normally";}JOptionPane.showMessageDialog(null, output," 用一个标志测试 break 语句 ",JOptionPane.INFORMATION_MESSAGE );System.exit( 0 );}}程序运行结果是A )窗口中有 5 行 * * * * *B )窗口中有 5 行 * * * *C )窗口中有 4 行 * * * * *D )窗口中有 6 行 * * * * * ” 相关考题
考题 下面程序的结果是includeclass A{int a;public:A( ) :a(1) {}void showa ( ) {cout 下面程序的结果是 #include<iostream.h> class A { int a; public: A( ) :a(1) {} void showa ( ) {cout < < a;} }; class B { int a; public: B( ) :a(2) {} void showa( ) {cout < < a;} }; class C: public A, public B { t a; public: C( ) :a(3) {} void showa( ) {cout < < a;} }; void main( ) { C c; c.showa( ) ; }A.1B.2C.3D.程序有错误

考题 请将下列程序的横线处补充完整,使得输出结果为bbaaincludeusing namespace std;class 请将下列程序的横线处补充完整,使得输出结果为bbaainclude<iostream>using namespace std;class A{public:______{cout<<"aa";}};class B:public A{public:~B(){cout<<"bb";}};int main(){B*p=new

考题 下面程序的运行结果是includeclass base{protected:int a;public:base( ){cout 下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base( ){cout<<"0";} }; class basel:virtual base { public: base1( ){cout<<"1";} }; class base2:virtual base{ public:A.123B.3120C.312D.3012

考题 下面程序的结果是includeclass A { int a;public: A():a(1){} void showa(){cout 下面程序的结果是 #include<iostream.h> class A { int a; public: A():a(1){} void showa(){cout<<a;} }; class B { int a; public: B():a(2){} void showa(){cout<<a;} }; class C:public A,public B { int a; public: C():a(3) ㈠ voidshowa(){cout<<a;} }; voidmain() { C c; c.showa(); }A.1B.2C.3D.程序有错误

考题 下面程序的结果是includeclass A{int a;public:A( ):a(1){}void showa( ){cout 下面程序的结果是 #include<iostream.h> class A { int a; public: A( ):a(1){} void showa( ){cout<<a;} }; class B { int a; public: B( ) :a(2) {}A.1B.2C.3D.程序有错误

考题 阅读下面程序:include template class TAdd{private:T x, y;public:TAdd(T 阅读下面程序:include <iostream.h>template <class T>class TAdd{private:T x, y;public:TAdd(T a, T b){x=a;y=b;}T add(){return x +y;}};void main( ){TAdd<int>a(5,6);TAdd<double>b(2.4,5.8);cout<<"s1 ="<<A. add()<<",";cout<<"s2="<<B, add()<<end1;}写出该程序的运行结果:【 】。

考题 下面程序的输出结果是()。include using namespace std;class A {public:A( ) {cout 下面程序的输出结果是( )。 #include <iostream> using namespace std; class A { public: A( ) {cout<<"A";} } class B { public: B() {coat<<"B" ;} } class C: public A { public: B b; C() {cout<<"C";} } void mian(){ C c; }A.CBAB.ABCC.ACBD.BCA

考题 下面程序的结果是 ______。includeclass A{ public:virtual voidfun()=0{};};class 下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file\n" ;} }; void main() { A a,*p; B b; C c; D d; p=c; p->fun (); p=b; p->fun (); p=d; p->fun(); }A.new file open file save fileB.new file new file new fileC.编译出错D.open file new file save file

考题 阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。 【说明】 以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。 【Java代码】 interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}

考题 阅读下面的程序, 写出运行后输出的结果。 #include<iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B :public A { public: B(){cout<<"B";} }; void main() { B b1; }