█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 2765

Problema 0x78 - Suma de 2 números

  • Autor: hamorillo
  • Fecha: 2021-02-04 12:55:13 UTC (Hace casi 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors

                    
#2
Error de compilación
                      Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors

                    
#3
Error de compilación
                      Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors

                    
#4
Error de compilación
                      Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors

                    
#5
Error de compilación
                      Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors

                    
Puntos totales: 0 / 100

Código

public class Main {
    public static void main(String[] args) {
        Nums nums = readNumsFromStdin();
        System.out.println(nums.a + nums.b);
    }

    private static Nums readNumsFromStdin() {
        Scanner in = new Scanner(System.in);
        return new Nums(in.nextInt(), in.nextInt());
    }

    private static class Nums {
        int a;
        int b;

        public Nums(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }
}