IndexOutOfBoundsException error

后端 未结 4 925
栀梦
栀梦 2021-01-29 10:53
public void thisisnotworking()
{
    Scanner input=new Scanner(System.in);
    String cardA;
    String cardB;
    System.out.print(\"Enter Card: \"); cardA=input.nextLi         


        
4条回答
  •  萌比男神i
    2021-01-29 11:30

    You must cast the return value of the readLine method to an Object, and then call the toString() method:

    cardA=((Object)in.readLine()).toString();
    

提交回复
热议问题