-
-
Save JoeUnsung/4e2b1cf0d5f21c749243af76257a1e45 to your computer and use it in GitHub Desktop.
Testcode #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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