Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: can someone fix my code to get the following output?

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can someone fix my code to get the following output?

    import 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

    Output 2:
    AaAaAa1
    BbBbB2
    CcCc3
    DdD4
    Ee5
    F6
    Output 3:
    1*A
    2**B
    3***C
    4****D
    5*****E
    6******F


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,116
    My Mood
    Mellow
    Thanks
    186
    Thanked 658 Times in 645 Posts

    Default Re: can someone fix my code to get the following output?

    We won't do it for you. If you have questions about how to do it or errors resulting when you try to do, please ask for help with those by giving us the info we need and asking specific questions.

Similar Threads

  1. Output is Wrong .How to fix it?
    By cmen535 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 5th, 2013, 01:15 AM
  2. Replies: 3
    Last Post: April 27th, 2013, 07:19 AM
  3. [SOLVED] Extra spaces in output - why & how to fix?
    By KL1209 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 7th, 2012, 11:44 PM
  4. How do i fix my code?
    By beebee007 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 14th, 2012, 10:49 AM
  5. How to fix this code?
    By ice in forum AWT / Java Swing
    Replies: 26
    Last Post: November 29th, 2010, 06:10 PM