Java编程-线程“主”中的异常java.util.InputMismatchException:错误

时间:2019-06-21 09:31:53

标签: java oop

这是让我感到困惑的代码:(Java OOP)

import java.util.Scanner;

class bank
{
    public static void main(String[] r)
    {
        Scanner s = new Scanner(System.in);

        System.out.println("enter the name");
        String a;
        a=s.nextLine();

        System.out.println("enter the phone no");
        int b;
        b=s.nextInt();

        System.out.println("enter your father name");
        String f;
        f=s.nextLine();

        System.out.println("enter your mother  name");
        String da;
        da=s.nextLine();

        System.out.println("enter 1 for loan 2 for deposit 3 for withdrawl 4 for information");

        int c;
        c=s.nextInt();
            switch(c) {
                case 1: {
                    loan d;
                    d=new loan();
                    d.display();
                    break;
                }

                case 2: {
                    deposit e;
                    e=new deposit();
                    e.display();
                    break;
                }

                case 3: {
                    withdrawl fa;
                    fa=new withdrawl();
                    fa.display();
                    break;
                }
            }
        }
    } 

0 个答案:

没有答案