View Single Post
Old 07-26-2012, 06:48 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
braces {} or brackets []?

brackets are used to declare an array (or point out the index of an array
example of brackets
Code:
int[] numArray = new int[5];
numArray[0] = 1;
numArray[1] = 7;
curly braces are used to chunk off sections of code as well as classes and namespaces...
example of curly braces:
Code:
private class demo
{
  ......
}

if(...)
{
   .....
}

else
{
   .....
}

for(.....)
{
   .....
}
etc...

You can also have both in one line, the declaration of an array and then initialization...
example:
Code:
int[] numbers = new int[7] { 4, 7, 2, 1, 3, 3, 0 };
Judging from your other posts, I think it would behoove you to do some intro to Java lessons. There are some here as well as additional resources in this thread. A little bit of google can go a long way.
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE

Last edited by alykins; 07-26-2012 at 06:52 PM..
alykins is offline   Reply With Quote