Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package java01;
- import java.util.Scanner;
- public class Code_anonying{
- public static void main (String[] args){
- Scanner sc = new Scanner(System.in);
- System.out.println("Digite el dato double: ");
- double num1 = sc.nextDouble();
- System.out.println("Su numero es: " + num1);
- }
- }
- Exception in thread "main" java.util.InputMismatchException
- at java.base/java.util.Scanner.throwFor(Scanner.java:939)
- at java.base/java.util.Scanner.next(Scanner.java:1594)
- at java.base/java.util.Scanner.nextDouble(Scanner.java:2564)
- at java01.Code_anonying.main(Code_anonying.java:12)
- AppDataLocalNetBeansCache10.0executor-snippetsrun.xml:111: The following error occurred while executing this line:
- AppDataLocalNetBeansCache10.0executor-snippetsrun.xml:68: Java returned: 1
- Scanner sc = new Scanner(System.in);
- System.out.println("Digite el dato double: ");
- try {
- double num1 = sc.nextDouble();
- System.out.println("Su numero es: " + num1);
- } catch (Exception e) {
- System.out.println("Error de digitación ");
- }
- import java.text.NumberFormat;
- import java.util.Locale;
- ...
- código
- ...
- Locale spanish = new Locale("es", "ES");
- NumberFormat nf= NumberFormat.getInstance(spanish);
- Scanner sc = new Scanner(System.in);
- System.out.println("Digite el dato double: ");
- double num1 = sc.nextDouble();
- System.out.println("Su numero es: " + num1);
- System.out.println("Error de digitación ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement