-
Recent Posts
Recent Comments
- Brian on How to plot multiple UK addresses (by postcode) on a Google Map
- Mark on How to plot multiple UK addresses (by postcode) on a Google Map
- Mark on How to plot multiple UK addresses (by postcode) on a Google Map
- Brian on Interview advice for PGCE ICT with Computing at KCL / IOE
- Brian on Blatant racist discrimination in advertisements
Tag Cloud
abstract accommodation array bursary Chrome date email enumerated type exam Excel fields finance generics Google greenfoot GTP GTTR hardware ICT interview Java KCL laptop linux literature review LMC London network news object OOP Oracle PGCE primary programming QTS QTS tests SER shortcut SSA static travel ubuntu UML variablesArchives
Categories
Meta
Tag Archives: array
How to sort (and reverse sort) an array of strings
This program demonstrates how to use Arrays.sort(…) to sort an array. There is also a more advanced example that uses a comparator to sort the array into reverse order. I’ve included a utility method dump(…) to output the array contents … Continue reading
Working with arrays of objects
Consider the following UML class diagram which shows the relationship between a superclass (Vehicle) and two subclasses (Motorbike and Car). Because Motorbike is a Vehicle and Car is a Vehicle, we can create an array of vehicles like this: The … Continue reading
Array .length property and String .length() method
You probably already know that we can use the length() method to get the number of characters of any String object in Java. For example, Knowing the length of the string is really useful as it allows us to calculate … Continue reading
Java program to summarise list of student exam grades
Java programming exercise: You have been given a list of student exam grades (A – E). Choose a suitable data structure to represent the list and write a program to calculate totals for each grade letter. My solution:
How to use arrays in Java
Arrays implemented in Java are of a fixed length and hold values of a single type (e.g. String). Each item in an array is called an element, and the first element is indexed at zero. The following code demonstrates three … Continue reading