Skip to content

Instantly share code, notes, and snippets.

@JoeUnsung
Created December 8, 2016 16:41
Show Gist options
  • Save JoeUnsung/4e2b1cf0d5f21c749243af76257a1e45 to your computer and use it in GitHub Desktop.
Save JoeUnsung/4e2b1cf0d5f21c749243af76257a1e45 to your computer and use it in GitHub Desktop.
Testcode #1
package joe;
import java.lang.*;
import java.util.*;
public class E1_20101062 {
public static void main(String[] args){
String[] color = {"red", "green", "blue", "white", "black", "yellow", "pink", "grey"};
Queue myQue = new LinkedList();
Stack myStack = new Stack();
for (int i = 0 ; i < color.length ; i++){
myQue.offer(color[i]);
}
for (int i = 0 ; i < color.length ; i++){
myStack.push(myQue.poll());
}
for (int i = 0 ; i < color.length ; i++){
System.out.println(myStack.pop());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment