gpt4 book ai didi

java - 错误整数自定义值Java

转载 作者:行者123 更新时间:2023-12-02 11:13:03 25 4
gpt4 key购买 nike

如何在以下程序中读取整数?没用目前无法编译。

/**
* Main class of the Java program.
*
*/
import java.util.Scanner;

//...
class Scanner{
Scanner in = new Scanner(System.in);
int num = in.nextInt();
}


public class Main {

public static void main(String[] args) {

// we print a heading and make it bigger using HTML formatting
System.out.println("<h4>-- Binaere Suche --</h4>");
int anzahl = 0; int zahl;

}
}

最佳答案

import java.util.Scanner;

// This will print what you want but will not make it look bigger as it
// will get printed in console
public class Main {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);
int num = in.nextInt();
// we print a heading and make it bigger using HTML formatting
System.out.println("<h4>--"+num+" --</h4>");

}
}

关于java - 错误整数自定义值Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50101914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com