This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Reg array initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Reg array initialization" Watch "Reg array initialization" New topic
Author

Reg array initialization

Pradeep Kumar
Ranch Hand

Joined: Sep 11, 2007
Posts: 77
What is the differnece between the below two declarations.
As results of both the statements are the same.Apart from that are there any other differences.


int[] aray1 = {1,2,3,4,5,5};
int[] aray2 =new int[]{1,2,3,4};

Regards,
Pradeep


SCJP 1.6
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Nope, no difference we need to think about.

Some of us wish we could use the first syntax anyplace an array is needed instead of only in initializations.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

"PradeepKumar", please check your private messages for an important message from me.
[ October 06, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Reg array initialization