hey guys,
-So in case 2, i'm trying to have the user to input elements (N,Y,P,D,G) only with specific Array location. I used switch inside a switch, but how do i re-loop if he enters wrong elements?

-in case 3, i'm trying to print the whole 2D array, but the original array is filled with the element G.

-in case 4, i'm trying to change the map view to the symbols.

Just found this as a practice, trying to learn, to some point, beginner complex programming, so any help is appreciated and any criticism is highly appreciated because i want to have a good basic knowledge of java :)

import java.util.Scanner;

public class Studyone {

    public static void main(String[] args) 
        Scanner input = new Scanner(System.in);
        int row;
        int col;
        int row1; //for case 2, so it would allow the user to input the element in the request array
        int col1;
        System.out.println("Enter the row: ");// knowing the row and the col of the 2D array to base the rest on.
        row = input.nextInt();
        System.out.println("Enter the col: ");
        col = input.nextInt();
        String sentence;
        String sentence2;
        String sentence3;
        String tempelement;
        String N;
        String Y;
        String G;
        String P;
        String D;
        int choice;
        System.out.println("The menu\n1)Enter the Elements in order\n2)Enter the the Col and row number spec.\n3)Show the Orig. map as is\n4)Show symbolic map.");
        choice = input.nextInt();
        String [][] map = new String[row][col];
        switch (choice)
            case 1:
                sentence3=input.nextLine();  // for some reason it auto enters the first map [0][0] as null, this line allows the user to input the map[0][0]
                for (int i = 0; i < map.length; i++) 
                    for (int j = 0;j < map[i].length; j++) 
                        System.out.println("Enter the element");
                        sentence2 = input.nextLine();

            case 2:
                System.out.println("Enter the row");
                row1 = input.nextInt();
                System.out.println("Enter the col");
                col1 = input.nextInt();
                System.out.println("Enter the element you want to enter");
                tempelement = input.nextLine();
                switch (tempelement)
                    case "Y":
                        map[row1][col1] = tempelement;
                    case "N":
                        map[row1][col1] = tempelement;
                    case "P":
                        map[row1][col1] = tempelement;
                    case "D":
                        map[row1][col1] = tempelement;
                    case "G":
                        map[row1][col1] = tempelement;

                System.out.println(tempelement);  // test,does not let me enter any temp elements, lets it empty in the input without letting the use enter anything. Figure out error
                System.out.println(choice); // test, prints the right choice, Correct.
            case 3:
                for (int i=0;i > map.length;i++)
                    for (int j=0; j > map[i].length; j++)
                        map[i][j] = N;
                        // print statment, need to find how to do.
            case 4:
                // having symbols instead of the letters, N=* , P= ~ , Y=. , G= #, D=@
This article has been dead for over six months. Start a new discussion instead.