Last active
          May 20, 2017 09:25 
        
      - 
      
- 
        Save pethaniakshay/53dd5317b70841dcbfc13ec02819f742 to your computer and use it in GitHub Desktop. 
    matrix using java 2-D ArrayList collection class
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.*; | |
| public class ArrayListMatrix { | |
| public static void main(String args[]){ | |
| List<ArrayList<Integer>> a = new ArrayList<>(); | |
| ArrayList<Integer> a1 = new ArrayList<Integer>(); | |
| ArrayList<Integer> a2 = new ArrayList<Integer>(); | |
| ArrayList<Integer> a3 = new ArrayList<Integer>(); | |
| a1.add(1); | |
| a1.add(2); | |
| a1.add(3); | |
| a2.add(4); | |
| a2.add(5); | |
| a2.add(6); | |
| a3.add(7); | |
| a3.add(8); | |
| a3.add(9); | |
| a.add(a1); | |
| a.add(a2); | |
| a.add(a3); | |
| for(ArrayList<Integer> obj:a){ | |
| ArrayList<Integer> temp = obj; | |
| for(Integer job : temp){ | |
| System.out.print(job+" "); | |
| } | |
| System.out.println(); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment