I want to search in linked list with scanner but i cannot do it. I can search without scanner. What is wrong with this code?
My search method:
public void Search(Object data){
Node tmp = head ;
while(tmp != null ){
if(tmp.getData() == data){
System.out.println("Your input is in the list");
}
tmp = tmp.getNext();
}
}
And my main class:
public static void main(String[] args) throws ParseException {
LinkedList list =new Linkedlist();
...... // adding methods etc.
Scanner input = new Scanner(System.in);
System.out.println("Enter your input: ");
String x=input.next();
list.Search(x);
}