View Single Post
Old 11-22-2004, 03:38 PM   #12 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
As for your palindrome stuff, there are a couple points.

Code:
public class Lab6 extends List
Is there a particular reason you're extending list?

Code:
public synchronized void push(string)
{
insertAtFront(string);
}

//remove object from stack
public synchronized String pop() throws EmptyListException
{
return removeFromFront();
string=new string1
}
There's no apparent reason for sychronization here. I assume you're not going to be finding palindromes in parallel.

Further, insertAtFront and removeFromFront aren't defined. You seem to want to treat Lab6 as a stack itself, but at the same time you've declared a stack.

Code:
if (
{
string=string1
}

then
{
JOptionPane.ShowDialog("This is a palindrone.");
}

else
{
JOptionPane.ShowDialog("This is not a palindrone.");
}
You're more comfortable in a different language, aren't you? :p

That's not how you setup a if-then-else in Java.

The format is
Code:
if(<boolean expression>){

}else if(<boolean expression>){

}else{

}
Does this have to be graphical, or can it be command line? Command line is easier to program for.
__________________
GitS
Belisarius is offline   Reply With Quote