Topics Discussed: In the most abstract fashion possible, I explain what we need to include and write to output text to the screen using java.

Source Code Available Here

In this video we talk a little bit about the structure of a normal java file.
Essentially, every java file (while we’re learning) will start with the words:

public class *filename*{

}//end class anything after // is considered a comment

The basic idea behind this line is that the compiler needs to know the name of the class in which things are being executed. We’ll talk a bit more about what the public means in this statement.

public static void main(String args[]){
//contents of main


The primary confusion from this statement is that it’s a LOT of different stuff all in one place. An access modifier, static declaration, command line arguments and other stuff. For now the only thing that you need to know about this statement is that it denotes where the main part of your program will be executing. There will be times when we operate outside of ‘main’, but that won’t be for some time.

Including and setting up Scanner:

import java.util.Scanner; // at the top of the program
Scanner input = new Scanner(;

This code includes an external library called “Scanner” which is used to take in input from our user. The code where we say ‘new’ allows us to use the word input as a way to take in user data. We’ll talk more about how this works a lot later in the tutorials.

Declaring variables are done like this:

Type Name;
int itemCost;//an integer with the name itemCost
char c; // A character with the name "c"-- 
//mind you, this character CAN store characters other than the letter C, as C is JUST a name

Variables are declared to store some kind of data, and the type of data they can store is based on how they are declared. About I mentioned ints, which store integers, or ‘non-decimal numbers’.

Outputting data in java is pretty easy. We use the following code:

System.out.println(a); // This would print out the variable a
System.out.println("Hello World"); // This would output the words "Hello World" exactly as they appear in the quotation marks.
System.out.println("Hello World" + a);//This would output Hello World followed by the contents of a

With that being said, we’ll talk a bit more about the syntax of outputting more later on in the series.

Lastly, we’re going to talk about commenting:

// This is a single line comment, anything you put after this is treated as a 'note' 
this is inside a multi - line comment
* as is this many people put a * at the beginning of each line in a 
multi-line comment to show that it's a comment to readers of the code
The end of this line ends the multi line comment */

Comments are notes that you and readers of your code can use to better understand the functions being carried out by your code are. I highly recommend commenting code heavily.

Topics Discussed: Introduced new data types, when to use said data types, variable naming schemes, and how the java compiler handles arithmetic

Source Code Available Here

At first I introduce the idea of style, which is going to be important for you to understand and develop as you progress in your learning. The essential bits of style that I want you to understand are as follows:

  • The more comments you have in your code, the better off you’ll be.
  • Every line should be ending with either an {, or a ; at this point in your programming if possible. Splitting output across multiple lines is bad, and I actually won’t be teaching you how to do so.
  • Giving your variables meaningful names will pay dividends later on when you come back to a program that you finished and want to revise. “itemCost” will make a lot more sense to you than “x”.

There are a few popular types of variable naming schemes out there. The most popular two out there are Hungarian notation, and Camelback notation. Hungarian notation isn’t as widely used in java, so I won’t really get into that here. Camelback notation on the otherhand seems to be everywhere on java forums, stackoverflow, etc. The basic idea is that any variable with more than one word in it’s name (itemCost, itemsOnHand, taxRate, etc. etc.) start with a lower-case letter and have the first letter in each word thereafter capitalized for additional readability.

New Data Types
As for new data types, I didn’t introduce every data type out there, but here’s a few that we’ll be using throughout this course

  • int– Integer numbers, somewhat small storage (16 bit in many cases, but can vary in some systems), non-decimal numbers.
  • float– Similar to int, float is the small-version of a number that can hold a decimal point if needed
  • double– Similar to float, but has a larger amount of storage, at the cost of taking up more space (32 bits vs 16 I believe)
  • char– A variable that holds a single character
  • String– A variable that holds a string of characters, whitespace included. Can hold multiple words.
  • The items below are used slightly less than the above but many are still very useful

  • short– Similar in part to int, but with even less storage
  • long– The exact opposite of short, same idea as int but with more storage.
  • unsigned (char/int/long/short/float/ double)– These can tend to hold larger numbers than their non-unsigned counterparts, however these variables cannot have a negative value applied to them.

Order of Operations
In java the order of operations is as follows:

  1. Parenthesis
  2. Multiplication / Division (equal priority, evaluates left to right).
  3. Addition and Subtraction (equal priority, evaluates left to right).

Due to the nature of how exponents are calculated in java (see: using a function), they are not considered in the order of operations. The code we can use to calculate some arithmetic is as follows.

int x=6, y=7;
System.out.println(x*y); // this would output 42
System.out.println(6*7); //this would also output 42
x+=6; // adds 6 to the current value of x, making it 12
int k = x-y; // assigns a value of 5 to k

Topics Discussed: Using java to compute simple calculations, such as bank interest.

Source Code Available Here

Homework: Write a ‘financial goal’ calculator, this calculator can take in a variety of inputs so long as it provides the unknown inputs via equation / logic. Example: allow input for Time invested / rate / how much money you want in the end — determine starting amount of money. Or Starting money, rate, and goal money, determine how long it would take. Etc. If you need help with this formula, or with posting your code to ideone, please let me know.

Compound operations
A compound operation is any time where we’re doing in one statement what might have otherwise taken more than one operation to state. There are actually 3 operations in this lesson that I would consider to be compound operations for varying reasons, lets take a look at each of them.

  1. double principle = input.nextDouble();
  2. The reason that I consider this to be a compound operation is because it would be more basic to have this as two statements, stated something like this:
    double principle;  principle = input.nextDouble();
    But as you can see, we are able to declare this in one statement.

  3. rate /= 100;
  4. The reason this is a compound operator is because of the special /= arithmetic operator. There are actually a few of those as follows:

    +=, -=, /=, *=, 

    All of these are handled in the same way. When you append them to a variable they have this basic syntax: “variable =variable(operation) number;”

  5. System.out.println("\nThe total amount of money in the account after: " + Time + " years is: " + (principle * (1+rate*Time)));
  6. The reason why this is a compound operation should be pretty apparent. Rather than using a variable named “total” to store the total amount of money, we’re actually computing it using math in the println statement.

Topics Discussed: Using the built in debugger to show us what is happening within our programs

Source Code Available Here

In this lesson we look at some of the most common errors that we’ll be running into throughout learning to code.

Common error messages:

; expected
This one is fairly simple it means that at some point you left out a semicolon
} expected
This is the same basic idea as above.

Using the built-in-debugger:
Using the debugger to better understand how our programs are running behind the scenes will teach us a lot about how the program acts, but also how our code handles things. To run the debugger, go up to the debug menu, and simply select “step into / step over”

Below is a cheat sheet on what each thing in the debugger means.

Step over- Go to the next line (and execute it)
Step over expression- Step over individual expressions within a statement
Step into: Go into a method
Step into next method:  Run everything to the next method.
Run to cursor: Compile normally until when they insertion point is reached.