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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
__Bill
Posts: 25
Joined: Thu Mar 27, 2014 11:35 am
Contact:

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

Post 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?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

No, it is not. Notice the { }.
You would be right if it were String[][] newargs = args; , which, of course, wouldn't compile.
If you like our products and services, please help us by posting your review here.

Boopalan
Posts: 1
Joined: Thu Jun 15, 2017 11:21 am
Contact:

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

Post 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.

Mikhail Volkov
Posts: 8
Joined: Mon Jul 29, 2019 11:25 am
Contact:

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

Post by Mikhail Volkov »

Hi! Tell me please.
Braces {} + array is a always sign of a 2D or more array. Right?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Not sure what you mean by {} + array
If you like our products and services, please help us by posting your review here.

Dreamweaver
Posts: 32
Joined: Mon Dec 29, 2014 4:14 pm
Contact:

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

Post by Dreamweaver »

:shock: its work even with:

String [][] newargs = { };

Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests