خرید بک لینک

Vote count: 0

I have a problem with my try/catch statement. I know it's probably an easy fix but I'm new to java. Here I want the console to prompt the user to add their initial deposit, for example, if I input something like "hello" the program will crash rather than ask again? thanks

System.out.println("Please enter an initial deposit:");
            try{  

                deposit.add(keyboard.nextInt());

            }catch(NumberFormatException e){

                System.out.println("Invalid input");

            System.out.println("Please enter an account number:");
            accountNumber.add(keyboard.nextDouble());

asked 32 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 7 فروردين 1395 ساعت: 22:26

صفحه بندی