博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
7-1 程序改错题4 (20分)
阅读量:4036 次
发布时间:2019-05-24

本文共 661 字,大约阅读时间需要 2 分钟。

程序改错题。请修改下列代码,使程序能够输出正确的结果。

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Thread t = new Thread(new RunHandler());
t.run();
}
}

class RunHandler {

public void run() {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
System.out.println(“run”);
}
}

输入格式:

输入一个整数x。

输出格式:

输出x行,每行一个字符串“run”。

输入样例:

4

输出样例:

run

run
run
run

import java.util.Scanner;public class Main {
public static void main(String[] args) {
Thread t = new Thread(new RunHandler()); t.start(); }}class RunHandler implements Runnable {
public void run() {
Scanner in = new Scanner(System.in); int x = in.nextInt(); for(int i=0;i

转载地址:http://rmbdi.baihongyu.com/

你可能感兴趣的文章
【剑指offer】面试题39:二叉树的深度
查看>>
【剑指offer】面试题28的习题:正方体,八皇后
查看>>
【剑指offer】面试题42:单词翻转顺序&左右旋转字符串
查看>>
【剑指offer】面试题43:n个骰子的点数
查看>>
堆排序及其相关操作
查看>>
【剑指offer】 堆排序查找最小的K个数
查看>>
【剑指offer】q50:树中结点的最近祖先
查看>>
二叉树的非递归遍历
查看>>
【leetcode】Reorder List (python)
查看>>
【leetcode】Linked List Cycle (python)
查看>>
【leetcode】Linked List Cycle (python)
查看>>
【leetcode】Word Break(python)
查看>>
【剑指offer】面试题26:复杂链表的复制
查看>>
【leetcode】Candy(python)
查看>>
【leetcode】Clone Graph(python)
查看>>
【leetcode】Sum Root to leaf Numbers
查看>>
【leetcode】Pascal's Triangle II (python)
查看>>
windows下 pip安装
查看>>
线程和进程
查看>>
UNIX 学习笔记-文件I/O(open)
查看>>