Home Answers Viewqa Java-Beginners STACK - WHY THE OUTPUT COMES LIKE THIS?

 
 


Mohamed Rafi
STACK - WHY THE OUTPUT COMES LIKE THIS?
0 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners

//: holding/StackTest.java import net.mindview.util.*;

public class StackTest { public static void main(String[] args) { Stack<String> stack = new Stack<String>(); for(String s : "My dog has fleas".split(" ")) stack.push(s); while(!stack.empty()) System.out.print(stack.pop() + " "); } } /* Output: fleas has dog My

WHY THE OUTPUT COMES LIKE THIS?

View Answers









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.