Skip to content
Advertisement

How to define a char stack?

How to define a char stack in java? For example, to create a String stack I can use such construction:

JavaScript

But when I’m try to put char instead String I got an error:

JavaScript

Advertisement

Answer

Using a collection of char is pretty inefficient. (but it works) You could wrap a StringBuilder which is also a mutable collection of char.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement