0

im having a problem with making stack with array converted to linked list

so far this is my code ...

import java.util.*;
public class Nkakainis {
public static void main(String[] args){
 Stack <String> istak = new Stack<String>();
 String[] names = {"john", "mark", "peter"};
 List<String> list1 = Arrays.asList(names);

 System.out.println("pushed " + istak.push(list1));
 
 }
}

i dont have an idea on how to push those strings..how can i display john, mark, peter?
and how can i make other stack operations show on the output (i.e. pop(), peek(), search(), isEmpty())?


corrections are greatly appreciated ... i really need ur help badly :(

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bettybarnes
0

Feel the difference between the element of the set, and a set of elements

for (String inner : list1) {
            System.out.println("pushed " + istak.push(inner));
        }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.