>>977820I can't "unify" them into just one of them for both
____Main class method(TestStackOfPalindromes)
package teststackofpalindromes;
import java.util.Scanner;
public class TestStackOfPalindromes {
public static void main(String[] args) {
StackOfPalindromes object = new StackOfPalindromes();
object.push("Anna");
object.push("Civic2021");
object.push("Computer");
object.push("Mad?am");
object.push("Level5");
object.push("M-am");
object.push("Java");
System.out.println("The palindromes are : ");
while(!object.isEmpty())
System.out.println(object.pop());
}
}
___
The "StackOfPalindromes" class is the same as above but changed default capacity to word.length(even though we are required to do one object so this is irrelevent imo)