import java.util.*; class CharArray { public static void main(String args[]) { String a[][]; a=new String[3][3]; int i=0,j=0; Scanner sc=new Scanner(System.in); System.out.println("Enter your characters"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { a[i][j]=sc.next(); } } System.out.println(); for(i=0;i<3;i++) { for(j=0;j<3;j++) { System.out.print(a[i][j]+" "); } System.out.println(); } } } /* Here I have used 3*3 matrix, you can also form any multi-dimension matrix by providing its size using scanner.*/
Comments
Post a Comment