Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Wed Nov 12, 2014 11:41 pm
by __Bill

Code: Select all

public static void main(String[] args) {
     FunWithArgs fwa = new FunWithArgs();         
    String[][] newargs = {args};
Is this not trying to assign a 1d array to a 2d array?

Re: About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Thu Nov 13, 2014 8:39 am
by admin
No, it is not. Notice the { }.
You would be right if it were String[][] newargs = args; , which, of course, wouldn't compile.

Re: About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Thu Jun 15, 2017 11:22 pm
by Boopalan
:joy:
admin wrote:No, it is not. Notice the { }.
You would be right if it were String[][] newargs = args; , which, of course, wouldn't compile.

Re: About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Wed Jul 31, 2019 12:44 pm
by Mikhail Volkov
Hi! Tell me please.
Braces {} + array is a always sign of a 2D or more array. Right?

Re: About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Wed Jul 31, 2019 8:44 pm
by admin
Not sure what you mean by {} + array

Re: About Question enthuware.ocajp.i.v7.2.1398 :

Posted: Tue Dec 01, 2020 7:42 am
by Dreamweaver
:shock: its work even with:

String [][] newargs = { };