PDrome.pop()=reverse.charAt(i); wrong.
- reverse is null -> NullPointerException
- Do you assign a value to a function? (Pop ())
You have to create the back of pop'ping from the stack.
So you should start with an empty line: reverse = ""; and add the characters taken from the stack:
while (!PDrome.isEmpty()) reverse += PDrome.pop();
Naming more
Please use capital letters to start fields and method names:
"someIntegerVariable" "methodForCalculation"
and only uppercase letters to start class names and interfaces:
Stack ArrayList MyClass
:)
(from Java conventions)
source share