This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Both messages mean that the compiler cannot find a method with a matching name and signature (sequence and types of parameters).Since that says "Stack" and not "java.util.Stack", I assume Stack is your own class. Check the method name and signature. That looks like a correct definition of a peek() method, but without Stack's definition I can only guess.This one is looking for a method named "equal" in class String that takes a String (or one of its superclass/interfaces, like Object). Look in the JavaDocs for String and you'll see that it overrides the method "boolean equals(Object)" from Object (note the "s").
Here's a free pointer:This is equivalent to [ October 22, 2004: Message edited by: David Harkness ]
Joined: Sep 22, 2004
Actually i use Class Stack in java.util and i already using java.util.*. For stack.peek(), it receive String data type and i put at variable top to compare. I have see the JavaDoc but how to define wrong?
Originally posted by nani aman: Actually i use Class Stack in java.util and i already using java.util.*. For stack.peek(), it receive String data type and i put at variable top to compare. I have see the JavaDoc but how to define wrong?
Given that the error message says "class Stack" and not "class java.util.Stack" (note that the other error message says "java.lang.String"), I would guess you have a variable named "Stack" with a capital S or you have defined your own Stack class.