Forums Register Login

<identifier> expected

+Pie Number of slices to send: Send
This is my first class dealing with queues, after all this is for Java 2 class. I keep trying to find out why Im getting the identifier expected error, and no such luck after tinkering for days...anyone able to catch it for me? Im sure its something silly but, staring at it for so long seems to be making it harder to find.
Thanks in advance :-)

ERRORS ARE:

NoDuplicatesQueueInterface.java:11: error: <identifier> expected
public NoDupQueueInterface<T>()
^
NoDuplicatesQueueInterface.java:16: error: <identifier> expected
public NoDupQueueInterface<T>(int initialCapacity)
^

2 errors
CODE

1
+Pie Number of slices to send: Send
Well, let's start with the fundamentals.

a) Firstly, what is the difference between a class and an interface?

a) Could you tell me what is a constructor, when do you write a constructor?
+Pie Number of slices to send: Send
I'm surprised you didn't get other errors first:


That shouldn't compile. All member variables in an interface are implicitly public static final. Trying to declare them otherwise is an error, as far as I know.

As for the lines you mentioned, you can't have constructors in an interface.

And there will be other problems too. You can't have concrete methods in an interface. All methods in an interface are abstract.
+Pie Number of slices to send: Send
I was waiting for him to come up with all this Jeff. You gave it away too easily.
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1116 times.
Similar Threads
A continuation of my previous post, if I may...
Convert Queue Dequeue to Link list format
Questions in relation to a queue.
Queue question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:16:29.