This code is working but i want my added words to show in vertical because its output is shown in horizontal if two or more words is inserted. Can you help me to improve my program? Here are the codes...

 * Write a description of class Stacks here.
 * @author (your name) 
 * @version (a version number or a date)

import java.util.*;

public class Queues_Lab2 {
    public static void main (String args[]) {
        Scanner s = new Scanner(;
        LinkedList st = new LinkedList();

        int count = 0;
        int y = -1;

        boolean b = false, checker = false;

        System.out.println("\n\t\t\t_ M _ E _ N _ U _");
        System.out.println("[1] Enqueue");
        System.out.println("[2] Dequeue");
        System.out.println("[3] View");
        System.out.println("[4] Front");
        System.out.println("[5] Rear");
        System.out.println("[6] Exit");
        System.out.print("CHOICE: ");
        String choice =;

        System.out.print("Enter word: ");
        if(count == 10) {
            System.out.println("Overflow Not allowed!");
            String enterWord =;

        System.out.print( st+ "is Inserted");


     else if(choice.equals("2")){
        if(count == 0) {
         System.out.println("Underflow Not allowed!");
        System.out.println("Queue Elements: \n" + st);
    else if(choice.equals("3")){
        System.out.println("Queue Elements: \n" +st );


    else if(choice.equals("4")){
        System.out.println("Front Elements: \n" +st.peek());


    else if(choice.equals("5")){
        int loc = st.size()-1;
        System.out.print("Rear Elements: \n" +st.get(loc));

    else if(choice.equals("6")){
        System.out.println("ByeBye! :)");
        System.out.println("Wrong Choice!!");


how about looping over st and printing it's elements, instead of printing st itself?

like? what do you mean like?
just print the elements of the LinkedList, instead of the List itself.

st is a linked list, not a string. Anytime you output an object like that it's going to use its default toString() method. You can either extend the LinkedList class and override the toString() method to keep the output implementation separate from your existing program, or simply write a new method in the Queues_Lab2 class to take a linkedlist as a parameter and output it vertically like you want by looping through all of the list's elements as stultuske said.