题目内容 (请给出正确答案)
[单选题]

阅读下面程序classex31{publicstaticvoidmain(String[]args){intx=60;inty,z;if(x>50){y=10;}z=y+x;}}现在想先编译再运行该程序,结果是()

A.70

B.60

C.编译出错

D.运行出错

提问人:网友lqlq2018 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有5位网友选择 D,占比26.32%
  • · 有4位网友选择 B,占比21.05%
  • · 有2位网友选择 C,占比10.53%
  • · 有2位网友选择 C,占比10.53%
  • · 有2位网友选择 D,占比10.53%
  • · 有2位网友选择 A,占比10.53%
  • · 有1位网友选择 A,占比5.26%
  • · 有1位网友选择 B,占比5.26%
匿名网友 选择了C
[181.***.***.191] 1天前
匿名网友 选择了A
[93.***.***.216] 1天前
匿名网友 选择了B
[239.***.***.4] 1天前
匿名网友 选择了B
[146.***.***.8] 1天前
匿名网友 选择了D
[203.***.***.0] 1天前
匿名网友 选择了C
[21.***.***.195] 1天前
匿名网友 选择了B
[90.***.***.106] 1天前
匿名网友 选择了D
[39.***.***.49] 1天前
匿名网友 选择了B
[158.***.***.134] 1天前
匿名网友 选择了A
[125.***.***.122] 1天前
匿名网友 选择了B
[155.***.***.107] 1天前
匿名网友 选择了C
[143.***.***.204] 1天前
匿名网友 选择了D
[208.***.***.162] 1天前
匿名网友 选择了D
[251.***.***.252] 1天前
匿名网友 选择了C
[3.***.***.172] 1天前
匿名网友 选择了D
[178.***.***.81] 1天前
匿名网友 选择了D
[104.***.***.111] 1天前
匿名网友 选择了A
[200.***.***.102] 1天前
匿名网友 选择了D
[224.***.***.7] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“阅读下面程序classex31{publicstaticvo…”相关的问题
第1题
3阅读下面程序1public class Try extends Thread{ 2public static void main(String args[ ]){ 3

3阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[ ]){ 3 Try t = new Try(); 4 t.start(); 5 } 6 7 public void run(int j){ 8 int i = 0; 9 while(i<5) { 10 System.out.pfintln("祝你成功"); 11 i++; 12 } 13 } 14 } 该程序要求打印5行“祝你成功”必须改正程序中的某行代码,程序才能完成。选择正确的修改是()。

A.将第1行的extends Thread改为implements Runnable

B.将第3行的new Try()改为new Thread()

C.将第4行t.sta.rt()改为start(t)

D.将第7行的publ void run(int j)改为public void run()

点击查看答案
第2题
在下面程序的空白处,应填入的正确选项是import java.io.*;public class ObjectStreamTest { publ

在下面程序的空白处,应填入的正确选项是 import java.io.*; public class ObjectStreamTest { public static void main(String args[])throws IOExeeption } ObjectoutputStream os=new ObjectOutputStream(new FileOutputStream("serial.bin")); java.util.Date d=new java.util.Date(); oos. ______(d); ObjectInputStream is=new ObjecttInputStream(new FileInputStream("serial.bin")); try{ java.util.Date restoredDate=(java.util.Date)ois.readObject(); System.out.println("read object back from serial.bin file:"+restoredDate); } catch(classNotFoundException cnf) { System.out.println("class not found"); } } }

A.WriterObject

B. write

C.BufferedWriter

D.writerObject

点击查看答案
第3题
下面程序中错误之处是 ______。 include<iostream.h> classA{private:intxl;protected:intx2;publ

下面程序中错误之处是 ______。

include<iostream.h>

class A{

private:

int xl;

protected:

int x2;

public:

int x3;

};

class B: public A{

private:

int b1;

protected:

int b2;

public:

int b3;

void disp(){cout<<x1<<b2<<end1;} //A

void set(int i){x3=i;} //B

};

void main()

B bb;

bb. a3=10 //C

bb. b3=10 //D

}

点击查看答案
第4题
3下面程序段的输出结果为()。package test;public class ClassA{ int x=20; static int y=6; publ

3下面程序段的输出结果为()。package test;public class ClassA{ int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); b.go(10); System.out.println("x="+b.x); }}class ClassB{ int x; void go(int y) { ClassA a=new ClassA(); x=a.y; }}

A.x=10

B.x=20

C.x=6

D.编译不通过

点击查看答案
第5题
下面程序的功能是将一个整数数组写入二进制文件。在下画线处应填入的选项是import java.io.*;publ

下面程序的功能是将一个整数数组写入二进制文件。在下画线处应填入的选项是 import java.io.*; public class XieShuzu { public static void main(String[] a) { int[]myArray={10,20,30,40}; try { DataoutputStream dos=new DataOutputStream(new FileoutputStream("ints.dat")); for(int i=0;i<myArray.1ength;i++)dos.______(myArray[i]); dos.close(); System.out.println("已经将整数数组写入二进制文件:ints.dat"); } catch(IOException ice) { System.out.println("IO Exception"); } } }

A.writeArray

B.writeByte

C.writeInt

D.writeDouble

点击查看答案
第6题
在Visual FoxPr0程序中不需要用PUBl,IC等命令明确声明和建立,可直接使用的内存变量是()。 A.局

在Visual FoxPr0程序中不需要用PUBl,IC等命令明确声明和建立,可直接使用的内存变量是()。

A.局部变量

B.私有变量

C.公共变量

D.全局变量

点击查看答案
第7题
public class A { public void draw(){System.out.println(“NO?”)}};} class B extends A { publ

public class A { public void draw(){System.out.println(“NO?”)}};} class B extends A { public void draw(){ System.out.println(“YES!”)};} A a=new B(); a.draw(); 输出结果是__________,最后两条语句程序体现了java的__________性质。

点击查看答案
第8题
写出程序的输出结果public abstract class A { public A() { Console.WriteLine('A'); } publ

写出程序的输出结果

public abstract class A

{

public A()

{

Console.WriteLine('A');

}

public virtual void Fun()

{

Console.WriteLine("A.Fun()");

}

}

public class B: A

{

public B()

{

Console.WriteLine('B');

}

public new void Fun()

{

Console.WriteLine("B.Fun()");

}

public static void Main()

{

A a = new B();

a.Fun();

}

}

点击查看答案
第9题
有如下程序:#include <iostream>using namespace std;int s=0;class sample { static int n;publ

有如下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } };

A.2

B.5

C.7

D.3

点击查看答案
第10题
对下列程序的叙述中,正确的是 1:public class X extends Thread implements Runnable{ 2:publ

对下列程序的叙述中,正确的是

1:public class X extends Thread implements Runnable{

2:publ主c void run(){

3: System.out.println(“this is run()”);

4:}

5:public static void main(String args〔〕){

6:Threadt二new Thread(new X());

7:t.start();

8:}

9:}

A.第1行会产生编译错误

B.第6行会产生编译错误

C.第6行会产生运行错误

D.程序正常运行

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信