I got this Error from Java | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

I got this Error from Java

I dont know how to fix it.. https://code.sololearn.com/c5ksLCXA3TiZ/?ref=app

22nd Feb 2020, 8:42 PM
Booztay
Booztay - avatar
8 Antworten
+ 1
Thankyou Denise Ro├čberg and Avinesh My Code Works Fine now Thankyoouu­čĺĽ
22nd Feb 2020, 9:03 PM
Booztay
Booztay - avatar
+ 1
Oh ok thankyou Again Denise Ro├čberg
22nd Feb 2020, 9:32 PM
Booztay
Booztay - avatar
0
Make these changes. int n = sc.nextInt(); // line 19 if (myList.contains(n)) // line 21 Seems like you haven't yet understood how to take user input for any given type. Kindly revise that part again.
22nd Feb 2020, 8:53 PM
Avinesh
Avinesh - avatar
0
myList = sc.nextLine(); myList is an ArrayList. .nextLine() returns a String. ArrayList != String if you want to fill your list with user input, you can use a loop: while(sc.hasNext()){ myList.add(sc.nextInt()); } if (myList.contains("12", "5", "10")) This does also not work. "12" is a String, but your list expects integer. Unfortunately you have to ask for all values separately using: (or use OR ||) if(myList.contains(12) && myList.contains(5) && myList.contains(10){ //your code }
22nd Feb 2020, 8:54 PM
Denise Ro├čberg
Denise Ro├čberg - avatar
0
Denise Ro├čberg di u know how to Create an Timer Event thingy?
22nd Feb 2020, 9:09 PM
Booztay
Booztay - avatar
0
Booztay What do you want to do?
22nd Feb 2020, 9:28 PM
Denise Ro├čberg
Denise Ro├čberg - avatar
0
I sent a message to you Denise Ro├čberg
22nd Feb 2020, 9:29 PM
Booztay
Booztay - avatar
0
Booztay And I am not sure if I can help you. So I think it is better to use q&a. Btw: I think to learn threads could be helpful.
22nd Feb 2020, 9:31 PM
Denise Ro├čberg
Denise Ro├čberg - avatar