Java Basics

To learning Java, you have to know the structure of Java programs.
Java programs are made up of words and symbols. There are also keywords that mean special things. You can think of them as a command, that you are telling your program to do something.

There is a special line that all of your JUDO Java programs will begin with; it looks like this:


void main() {

Your program must also always end with a special line:

}

The the word main means that all the lines following are the main part of your program, and the lines must all be inside the the curly braces ( { and } ).

What you do inside of the main is what makes your program interesting. There are lots of structures and keywords and code that you can put in there, and you will be learning about many of them in the following parts of this tutorial.

Below is a preview program so you have an idea what a Java program looks like. It multiplies two numbers together and prints them out to the user.

void main() {
   int product;
   product = 3 * 4;
   printLine("Three times Four is: " + product);
}

You can use all the common math operations in your programs. The symbols you use to do the operations are:
+	addition
-	subtraction
*	multiplication
/	division

In the next two parts of the tutorial, you will learn about the most important and basic parts of programming: Data Types and Values, Variables, Declarations, and Assignments.

Back to JUDO and Java     Forward to Data Types