Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TwoD{
- Scanner scanner = new Scanner(System.in);
- int userInputRows;
- int[][] vals = new int[userInputRows][];
- public void columnInput(){
- //System.out.println("How many rows would you like to have");
- //userInputRows = scanner.nextInt();
- for (int i=0; i<3;i++){
- System.out.println("Hello");
- }
- for (int row=0;row<vals.length;row++){
- int realRowID = row+1;
- System.out.println("For row "+realRowID + " How many columns would you like");
- int userInputColumns = scanner.nextInt();
- vals[row] = new int[userInputColumns];
- }
- }
- }
- public class MyClass {
- public static void main(String[] args) {
- TwoD twoDArray = new TwoD();
- twoDArray.columnInput();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement