Beginning Java5Homepage  « Learn Java5 « Beginning Java5

We start out by downloading a JDK and setting up our environment before beginning our journey into Java5. With the environment set up we introduce the code structure of a Java source file and look at syntax. After this we look at the primitive variables available in Java before discussing method scope. We then take an in-depth look at the symbols used for mathematical and logical manipulation that are recognised by the compiler and commonly known as operators. Every computer language has conditional branching and loop structures and Java is no exception. We finish off this section with a look at the conditional and loop statements available in Java5.


Getting Started

In our first lesson on Java5 we download the latest JDK from the Oracle site and setup our environment. We then check that everything is working correctly and our environment is set up by running a check to see if the Java compiler can be accessed from the command line.


Code Structure & Syntax

Now we have the basic environment set up we can take a look at the code structure of a Java source file and look at some syntax. In this lesson we do this, we then look at how to run our own programs/applications and finish the lesson by running our very first Java program.


Primitive Variables

Java comes with two types of variables to choose from, primitives and reference. In this lesson we look at the various primitive data type variables that are available in Java, what we can store in each primitive type and when and how to use them.


Method Scope

You may be familiar with terminology such as global variables and local variables from languages such as JavaScript but this isn't the most accurate way to describe variables and their scope in Java. In fact Java comes with three kinds of variables and we name variables according to the scope they reside in. This lesson is all about local variables, which pertain to methods and their scope.


Operators

Symbols used for mathematical and logical manipulation that are recognised by the compiler are commonly known as operators in Java. In the first of two lessons on operators we look at the arithmetic, relational, logical and assignment operators.


Bitwise Operators

In the second lesson on operators we look at the bitwise logical and bitwise shift operators. Bitwise operators perform their operations on the integer types byte, short, int and long and will not work with any other type. These operators are used to manipulate the bits within an integer value, hence the name.


Conditional Statements

In this lesson we look at the conditional statements available in Java. Conditional statements allow us to evaluate an expression and execute some code dependent upon the outcome. There are two conditional statements we can use with Java, the if statement and the switch statement; the choice of which to use really depends on the expression being evaluated.


There is also the tenary ? : special operator which acts like an if statement and which we will cover after looking in detail at the if statement.


Loop Statements

In this lesson we look at the loop statements available in Java. Loop statements allow us to iterate over some code multiple times. There are two loop statements in Java, the for statement and the while statement and the various forms of each are covered here.



<<  Learn Java5                    Getting Started  >>

go to home page Java5 Tutor Homepage go to top of page Top