Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. class TwoD{
  2.  
  3.  
  4.     Scanner scanner = new Scanner(System.in);
  5.     int userInputRows;
  6.     int[][] vals = new int[userInputRows][];
  7.  
  8.  
  9.  
  10.     public void columnInput(){
  11.         //System.out.println("How many rows would you like to have");
  12.         //userInputRows = scanner.nextInt();
  13.         for (int i=0; i<3;i++){
  14.             System.out.println("Hello");
  15.         }
  16.  
  17.         for (int row=0;row<vals.length;row++){
  18.             int realRowID = row+1;
  19.             System.out.println("For row "+realRowID + " How many columns would you like");
  20.             int userInputColumns = scanner.nextInt();
  21.             vals[row] = new int[userInputColumns];
  22.         }
  23.     }
  24.  
  25.  
  26. }
  27.  
  28.  
  29. public class MyClass {
  30.     public static void main(String[] args) {
  31.         TwoD twoDArray = new TwoD();
  32.         twoDArray.columnInput();
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement