Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误整数自定义值Java_Java_Class_Input_Compiler Errors_Main - Fatal编程技术网

错误整数自定义值Java

错误整数自定义值Java,java,class,input,compiler-errors,main,Java,Class,Input,Compiler Errors,Main,如何在下面的程序中读取整数?它不起作用。目前还没有编译 /** * 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(Stri

如何在下面的程序中读取整数?它不起作用。目前还没有编译

/**
 * 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;

    }
}
/**
*Java程序的主类。
* 
*/
导入java.util.Scanner;
//...
类扫描器{
扫描仪输入=新扫描仪(系统输入);
int num=in.nextInt();
}
公共班机{
公共静态void main(字符串[]args){
//我们打印一个标题,并使用HTML格式将其放大
System.out.println(“--Binaere-Suche--”);
int anzahl=0;int zahl;
}
}
导入java.util.Scanner;
//这将打印您想要的内容,但不会使其看起来更大
//将在控制台中打印
公共班机{
公共静态void main(字符串[]args){
扫描仪输入=新扫描仪(系统输入);
int num=in.nextInt();
//我们打印一个标题,并使用HTML格式将其放大
System.out.println(“-”+num+“-”);
}
}

然后呢?仍缺少某些内容../Root/src/Main.java:23:error:int无法取消引用zahl.Scan();^注意:./Root/src/BinarySearchFactory.java使用未经检查或不安全的操作。注意:使用-Xlint重新编译:未选中以获取详细信息。1 println use
Scanner sc=新扫描仪(System.in)下的错误;int zahl=sc.nextInt()删除Scanner类(它已经在java中了)谢谢,它现在可以编译了。
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>");

    }
}