Outputimport javax.swing.*; import java.util.*; public class Question3 { public static void main(String[] args) { Stack stack1 = new Stack(); Stack tempS = new Stack(); Queue queue1=new Queue(); Queue tempQ = new Queue(); stack1.push("F"); stack1.push("E"); stack1.push("D"); stack1.push("C"); stack1.push("B"); stack1.push("A"); queue1.enqueue(1); queue1.enqueue(2); queue1.enqueue(3); queue1.enqueue(4); queue1.enqueue(5); queue1.enqueue(6); //print all elements Object data=null; String J=""; while(!stack1.isEmpty()) { data= stack1.pop(); J=((String)data); System.out.println(J.toLowerCase()); tempS.push(data); } int index; } }
Output 2:
AaAaAa1
BbBbB2
CcCc3
DdD4
Ee5
F6
Output 3:
1*A
2**B
3***C
4****D
5*****E
6******F