File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Reg array initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 56215
    
  13

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

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Reg array initialization
 
Similar Threads
integer literals
can anyone please check my method
Generating thumbnail on unix
What is the difference between these statements
getting values from JTable and putting them into textfields