Превратить мой стек в строку?JAVA

Программисты JAVA общаются здесь
Anonymous
Превратить мой стек в строку?

Сообщение Anonymous »

Код: Выделить всё

String message = ""; //a string to store the whole message
for (int c = stack.length - 1; c >= 0; c--) {
message += ", "+stack[c];  //add the next element to the message
}
message = message.substring(2); //cut off the first ", "
return message;
Это помогло решить мою проблему; спасибо

Подробнее здесь: https://stackoverflow.com/questions/172 ... o-a-string

Вернуться в «JAVA»