Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Arun GOPI Newsgroups: comp.lang.java.programmer Subject: Re: Arrays in java Date: Mon, 16 Jul 2012 02:53:59 -0700 (PDT) Organization: http://groups.google.com Lines: 12 Message-ID: <848eec20-ab75-4a89-b605-cc5fc81b09d5@googlegroups.com> References: <7eb3b37e-612a-4f51-98e5-f39cfd565739@googlegroups.com> NNTP-Posting-Host: 210.212.236.21 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1342432440 29348 127.0.0.1 (16 Jul 2012 09:54:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 16 Jul 2012 09:54:00 +0000 (UTC) In-Reply-To: <7eb3b37e-612a-4f51-98e5-f39cfd565739@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=210.212.236.21; posting-account=dww7oQoAAAAMWgKVIaqd5pk2iBUToh2n User-Agent: G2/1.0 Xref: csiph.com comp.lang.java.programmer:16039 On Monday, 9 July 2012 20:24:39 UTC+5:30, mmc.java wrote: > I am just starting to learn java and wanted to know when creating an array if there is any reason why you choose one of the following over the others or if it is just a styling choice by the developer > > int productIDs[] = {10,20,30}; > int []productIDs = {10,20,30}; > int[] productIDs = {10,20,30}; > > I did notice the the following will cause a compilation error > []int productIDs = {10,20,30}; //causes an error By java convention the standard is int[] productIDs = {10,20,30}; the brackets must indicate the data type.The other way is also allowed but discourager.refer : http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html