全部评论
没有也,你的代码是怎样的呢?这是我的博客链接https://blog.csdn.net/qq_40859852/article/details/100145993,希望能对你有帮助。
public class Main { public class void main(String[] a) { Scanner in = new Scanner(System.in); String str = in.nextLine(); System.out.println(str + "_A_B_C"); } } 这样过可以吗?
同超时,本地通过了
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
System.out.print(line);
scanner.close();
for (int i = 0; i < 3; i++) {
new Print(i, "_" + (char)('A' + i)).start();
}
}
}
class Print extends Thread {
public static volatile int flag = 0;
private int id;
private String val;
public Print(int id, String val) {
this.val = val;
this.id = id;
}
@Override
public void run() {
while (true) {
if (id == flag) {
System.out.print(val);
flag++;
return;
}
}
}
} 没超时,通过
相关推荐
11-08 13:58
门头沟学院 Java 点赞 评论 收藏
分享