Basic Program I need help
I need some help, i can't understand Why i can´t use it, it said me:`scanner` is never closed.
Thanks
Copy this code and paste it in your HTML
package demo1;
import java.util.Scanner;
public class Screen2
{
public static void main
(String[] args
) {
Scanner scanner
= new Scanner
(System.
in); System.
out.
print("Escriba su nombre: "); System.
out.
print("Escriba su edad: "); int edad = scanner.nextInt();
System.
out.
print("Escriba su altura en m: "); double altura = scanner.nextDouble();
System.
out.
println("Su nombre es: " + nom
); System.
out.
println("Su edad es: " + edad
); System.
out.
println("Su altura es de: " + altura
+ "m"); }
}
Report this snippet
Comments
Subscribe to comments