本文共 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 runimport 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/