• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

array gotchas

 
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm looking for any potential gotchas I might have missed.
A couple of points I came across:-

From K & R
int [] x , y ; //defines two arrays of ints
int x [], y; //defines one array of ints and one int primitive
K and R states that if [] follows the type then all variables in the declaration are arrays. Otherwise the [] must follow each array name in the declaration.
From Dan's exam:-
int []a3,[]a4;
does not compile, because the [] must be placed after the type or identifier.

None of these seem to be covered in S & B. Am I just getting pre-exam jitters or what?
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't sweat this type of stuff too much. The exam's purpose isn't to give you every possible permutation of an array declaration to see if you have a java compiler built into your brain. The exam is a good test of your array knowledge, but it doesn't do this by using gimmicky questions.
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic