0
I got this Error from Java
I dont know how to fix it.. https://code.sololearn.com/c5ksLCXA3TiZ/?ref=app
8 Answers
+ 1
Thankyou Denise RoĆberg and Avinesh My Code Works Fine now Thankyoouuš
+ 1
Oh ok thankyou Again Denise RoĆberg
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.
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
}
0
Denise RoĆberg di u know how to Create an Timer Event thingy?
0
Booztay
What do you want to do?
0
I sent a message to you Denise RoĆberg
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.