Exercises, examples and other material relating to training module J705. This topic is presented on public courses Learning to Program in Java
, Java Bootcamp
, Java Programming for the Web
A regular variable can hold one piece of information, but an array can hold more than one. Arrays are declared to hold a number of elements, and data is then written to and read from each element based on its position number.
|Articles and tips on this subject||updated|
|4347||Arrays in Java - an introduction for newcomers|
In Java, arrays are objects but with some extra syntax which gives you additional ways to access them, for example using a traditional subscripting notation. From the Java Course I am running this week, an example written in front of my delegates is [here].
Setting up an array ...
|3118||Arrays of arrays - or 2D arrays. How to program tables.|
It's shorthand when you're learning a new programming language to ask "how does it handle multiple dimension arrays" ... but in practise very few languages actually support true multidimensional arrays these days, and in those which do you might be well advised to use an alternative that's more flexible.
|3039||Fresh Paint - Java Arrays|
I've just applied a coat of fresh paint to some of our Java examples - Arrays in Java - and added the refurbished examples on the web site. The great news is that the old code just worked (I love compatability) but I have much improved the comments.
1. [code] - a 2 dimensional array (or strictly speaking ...
|3038||Setting up individual variables, and arrays, in Java - some commented examples|
In Java, variables must be defined before they have an initial value assigned to them, and they must have an initial value assigned to them before the value thay contain is used; there's no automatic assumption that a new name is a variable, nor is there an assumption made of what type of data a variable ...
|2648||Java arrays - are they true arrays or not?|
Java's arrays are "true" arrays, in that they occupy sequential memory locations in which they are looked up by position number, so that access can be very fast. But that does mean that once an array has been defined to be a certain size, it cannot be resized in situ.
Fortunately, Java is a dynamically ...
|1614||When an array is not an array|
An array, I was taught, is a sequential series of memory locations in which values of some type are stored. In an array, each of the memory locations is the same size (number of bytes). And so, as I was taught, arrays can be used very efficiently using pointer arithmetic, BUT they need to:
a) Be defined ...
|1498||Java is a dynamic language .... (and comparison)|
Many older programmers are used to setting up an array of a fixed size and saying "that's fixed" ... for the duration of the program, if not for all time until the application is recompiled.
Languages such as C gave us malloc, calloc and realloc (and things have progress on somewhat in C++) to let us ...
|1497||Training Season Starts again!|
I'm glad that our business isn't heavily seasonal - tourist places like Longleat have a heavy summer and a barren winter, and The Christmas Shop must, surely, be heading for a quiet few months.
But we are - slightly - seasonal; we have a quiet three weeks where no-one wants to learn Perl or PHP (or ...
Examples from our training material
PicturesStudying Java in Oxford
This module is available under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
Definition and declaration.
Array manipulation and replacement.
Arrays of Objects.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.