Exception in thread main java.util.InputMismatchException error

前端 未结 5 2048
孤街浪徒
孤街浪徒 2020-12-22 10:39

I have a question on what\'s going on, whenever I try to compile it it keeps giving me an error like this:

Exception in thread \"main\" java.util.InputMismat         


        
5条回答
  •  情话喂你
    2020-12-22 10:51

    import java.util.*;
    class Employe
    {
        private int id;
        private String name;
        Employe(int id,String name)
        {
            this.id=id;
            this.name=name;
        }
        public int getId() {
            return id;
        }
        public void setId(int id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
    public class Quarantine {
    public static void main(String[] args) {
        Employe empList[]=new Employe[2];
        Scanner sc=new Scanner(System.in);
        for(int index=0;index

    if I give input as 1, a

    it will show error because both are taken as character

    I need to give input as 124, a run

提交回复
热议问题