+1

What's wrong in the following code and why?

Class A{ public static void main (String args[][]){ System. out. print("hello"); } public static void main (String args[][][]){ System. out. print("world"); } }

9/3/2019 11:42:38 AM

Gangadhar

3 Answers

New Answer

+3

It shouldn't be public static void main (String args [][]) But: public static void main (String[] args)

+3

I know that. But what is the difference between both main functions...

+3

The difference is the dimensions of the array. For example if you try to get access to two dimensions array[][]: String [][] args = new String [1][1] args [0][0] = ... But for one dimension array []: String [] args = new String [1] args [0] = ...