Posted By

DANI14 on 06/25/14


Tagged


Versions (?)

Basic Program I need help


 / Published in: Java
 

I need some help, i can't understand Why i canĀ“t use it, it said me:scanner is never closed. Thanks

  1. package demo1;
  2. import java.util.Scanner;
  3. public class Screen2
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner scanner = new Scanner(System.in);
  8. System.out.print("Escriba su nombre: ");
  9. String nom = scanner.next();
  10. System.out.print("Escriba su edad: ");
  11. int edad = scanner.nextInt();
  12. System.out.print("Escriba su altura en m: ");
  13. double altura = scanner.nextDouble();
  14. System.out.println("Su nombre es: " + nom);
  15. System.out.println("Su edad es: " + edad);
  16. System.out.println("Su altura es de: " + altura + "m");
  17. }
  18.  
  19. }

Report this snippet  

You need to login to post a comment.