Categories
Certification Java SCJP

Java; the for-each loop, perfect for fondling collections and arrays

The for loop is great, but is it really that nice when you want to iterate over an array or collection? You’d have to do something like the following : Works fine doesn’t it? Looks a bit messy doesn’t it? No need for the index since we only ever use it to get the current […]

Categories
Certification Java SCJP

The do-while loop, always executes at least once…

As I’ve covered in a previous post regarding the while loop, the do-while, often refered to as the do loop is very similar. Lets have a look at the psuedo code. So as we can see, the actual body of the loop gets executed at least once before the boolean expression is ever evaluated. Now […]

Categories
Certification Java SCJP

Using while loops, for when you don’t know how long the piece of string is…

Just another bitesize SCJP post here, looking at the while loop in Java. There may be times, where you need to continually iterate over a code block for an unknown number of times. What you can do, is to loop through a code block while a condition is true, something else might change that condition, […]

Categories
Certification Java SCJP

Playing with the For loop in Java…

The for loop is an extremely flexible and powerful way of iterating over a code block for a set number of times. Generally speaking, this type of loop is great for situations when you need to repeat code for a definitive number of times, for example you know that your shopping basket contains 10 items, […]

Categories
Certification Java SCJP

Overriding and Overloading, a n00bs explanation…

This is easily one of the most confusing concepts to a n00b, but to be honest its relatively simple. The most confusing part is that both start with the letter ‘O’. You’ll really need to understand this if you plan to get anywhere as a programmer, as you can bet you’ll be asked “what is […]

Categories
Certification Java SCJP

Static Imports, how they could and should be used

One of the new features of Java 5 is the static import, its quite simple in nature. You have probably done something like the following many times before : Nothing too complex, you’re refering to static methods on the System and Math classes. If you use a lot of static methods from other classes, you […]

Categories
Certification Java SCJP

Declaration Rules in Java

Another one of my short and sweet posts in my SCJP study guide section. This one is quite straightforward, so we’ll keep it quick, since I know you’d much rather be facebooking or watching cats do strange things on youtube… Declaration rules, in regards to the class files themselves, meaning what you can and can’t […]

Categories
Java SCJP

Identifiers and JavaBeans

Identifiers are what we use to identify parts of our code, whether this is a class, method or a variable. There are some ground rules on the names we can give to these identifiers, and it is good to understand the ground rules regarding these. There are 3 levels, or aspects of identifiers, and are […]