TÓPICO

Não sei identificar o erro

Stnrenan perguntou 2 years ago

codifiquei dessa forma;

public class Main {

public static void main(String[] args) throws IOException {

Scanner in = new Scanner (System.in); int A = in.nextInt(10); int B = in.nextInt(9); int X = A+B; System.out.println("X = " +X);

porém ele diz que tem um erro no ( Scanner in = new Scanner (System.in);) não sei o que é


o que erro é esse

Main.java:13: error: cannot find symbol Scanner in = new Scanner (System.in); ^ symbol: class Scanner location: class Main Main.java:13: error: cannot find symbol Scanner in = new Scanner (System.in); ^ symbol: class Scanner location: class Main 2 errors

Lembre de não publicar soluções. Sua publicação pode ser revisada por nossos moderadores.

  • Tahsin09 respondido 1 year ago

    Your are supposed to read numbers through Scanner

    Write int A = in.nextInt()instead of int A = in.nextInt(10)

    A problem can give you any 2 numbers one line after another, so your code must be repared that way in order to takle any 2 integers