Java programming double dimensional arrays -



Java programming double dimensional arrays -

my aim here type simple code take in number input user , print simple matrix. code typed seems compile doesn't work during run time! code this:

import java.util.scanner; class arr { public static void main() {scanner in=new scanner(system.in); int a[ ][ ]=new int[2][3]; for(int i=0;i<2;i++) { for(int y=0;y<2;y++) { a[i][y]=in.nextint(); } } for(int i=0;i<2;i++) { for(int y=0;y<2;y++) { system.out.print(a[i][y]); } } } }

at same time suggest solution if transpose matrix inputted user?

you have defined main method incorrectly. proper main method signature is

public static void main (string[] args)

that's why compiler not compiling code.

java arrays

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -