0

I need to know how to create methods to compare two sets of singly linked lists. The only problem is that I can't put a linkedlist inside the method parameters. Please help

import java.util.*;

public class SLinkedList {
  protected Node head; // head node of the list
  protected Node tail;
  protected int size; // number of nodes in the list
  /** Default constructor that creates an empty list */
  public SLinkedList() {
      head = new Node(null, null); // create a dummy head
      
      size = 0;
  }
 public boolean(SLinkedList obj){//tells me identifier is expected
      return true;
  }
2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Gsterminator
0

public boolean(SLinkedList obj)

You have missed the method name here, that why it throws and error as identifier expectd... Give a method name like

public boolean methodName(SLinkedList obj)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.