Your browser has JavaScript turned off. This page is best viewed with Javascript enabled. Certain functions on this site will not work, and some style sheets will not load. Check your browser preferences to enable JavaScript.

Teach Yourself Java

Java Glossary

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z


A

Applet
Applets are compiled Java programs which are run through either an Appletviewer or from a web browser. Applets run in their own frame (within the web page) and can do many things including displaying graphics, playing sounds, and accepting inputs (like mouse clicks or typing from the keyboard). Applets are commonly used to add interactivity to websites.

To learn more see our What is an Applet? page.

Applet Tag
To put your Java applet on a web page, you need to insert the applet tag in the HTML of your website. The applet tag looks like this: <applet code="HelloWorld.class" width=200 height=50></applet>

For more information on making web pages and inserting applets in your websites, see our Basic HTML guide.

Application
An Application is a stand-alone Java program that you generally run from the command prompt. You've used applications before (probably without realizing what it was). For example, when you type a paper using a word processor (like Microsoft Word), you are using an application (although not necessarily a Java application, it is an application none-the-less).

To learn more see our What is an Applet? page.

Array
Arrays are a type of data structure that allows you to store a number of values in a single structure. Arrays basically allow you to put into one structure what you would normally have to put into many variables. It makes organizing and finding those values much easier since you don't have to keep track of many different variables, you just have to keep track of the one array.

Assignment
An assignment statement is used to give a value to a variable. It looks like this:
  • "x = 5;" - MAKE SURE TO USE ONE EQUAL SIGN!


B

Boolean
A boolean is a variable type that can only have one of two possible values - TRUE or FALSE. Booleans are commonly used in conditionals and loops.

Bytecode
Bytecode is the code generated by the Java compiler that will make the Java Virtual Machine run on your computer.  It is basically an intermediate step between the code that you write and the code that your computer executes.

To learn more see our What is Java? page.


C

Char
A char is a variable type that represents a single character.  Chars can be any single letter, number or any other type of single character.

Comment
Comments are used to make notes on your program without affecting the code. By simply writing two slashes // before any text that text will not be compiled. This is a good way to take notes, explain complicated code, or to write for each function what each parameter should mean and what is returned to ensure the user knows what is going on.

Comparison
Comparison statements are used in Conditionals and Loops. They usually look like this:
  • "(x == 5)" - MAKE SURE TO USE TWO EQUAL SIGNS!
  • "(x > 5)"
  • "(x < 5)"

Compile
A Java program is written in sourcecode and then compiled into bytecode. This bytecode is then interpreted by the Java Virtual Machine.

To learn more see our What is Java? page.

Conditional
A conditional statement is a series of code that allows the execution of portions of a program according to the value of some Comparison statement. Conditionals use ‘if’, ‘else if’, and ‘else’s to decide what code to execute based on a test statement of some kind. Conditionals are basically like ‘if-then’ statements in English. They usually look like this:

if (x == 5)
{
    x = x + 19;
}


d

Do-While Loop
Do-while loops are similar to ‘while’ loops except that they run through the body of the loop once before checking the test statement. See ‘While Loop’ below for more information.

Double
A double is a numeric variable type that is similar to a float. Doubles are all real numbers, meaning that they can be used with decimals..


E


F

Float
A float is a numeric variable type that is not only all integers, but includes all decimals as well. Floats are often used when an exact division is necessary rather than division with no remainders.

For Loop
For loops are sections of code that are designed to be repeated a certain number of times. For loops all include an initialization, test statement and update in the initial line of code, followed by the body of the loop. For loops should be used when the exact number of times to repeat is a known value. They are also helpful for iterating through arrays. For loops usually look like the code below:

for (int i = 0; i < intArray.length; i++)
{
    intArray[ i ] ++;
}

Function

A function is a piece of code that is self-contained in a program. Each function should perform a specific task, and can be called from other functions. A function is ‘called’ by using a statement that calls the name of a function followed by whatever necessary parameters in parentheses after the name. Functions are the basic way of organizing a program into smaller steps. Every function is declared by saying whether it is public or private, whether it is void or returns a value, its name, and any parameters.

For more on functions, see Lesson 6.



G



H

HTML
HTML stands for Hyper-Text Markup Language. It is the standard language for creating websites (aka web pages).

To learn some basics of HTML, see our HTML guide.


I

If Statement
An if statement is a conditional which states that if some test statement is true, the code in the brackets below the if statement should be executed.

If-Else Statement
An if-else statement is a conditional that states that if some test statement is true, the code between the brackets below the if statement should be executed. Otherwise, the code between the brackets below the else statement should be executed.


Import
When you see import at the top of all of your programs, those statements mean you are importing a certain portion of the Java language to use in your program. These statements make it easier for the compiler to do its job because it only has to compile the libraries relevant to your program. It also allows you to not have to refer to each type of object by its full name, which usually includes the library path.

Inheritance
Inheritance in Java refers to when a class ‘extends’ another class. The class that is defined as extending another class is the subclass. The subclass can use any variables or functions defined in the original class (called the super class) as its own as long as they are not defined as ‘private’.

int
An int is a numeric variable type. It is the basic, generic variable for integer values.

Interpreter
A Java Interpreter is what actually translates the compiled bytecode and executes that translation on the computer.

To learn more see our What is Java? page.



J

Java
Java is a high-level, object-oriented computer programming language.

To learn more see our What is Java? page.


Java Virtual Machine (JVM)
The Java Virtual Machine is what is necessary to be in place on any machine in order for Java bytecode to run on that machine. Essentially, the JVM makes it possible for Java to run on any type of platform.


K


L

Loops
Loops are segments of code that are repeated either for a designated number of times or until a certain test statement is true.

See also For Loops, While Loops, and Do-While Loops.



M

Method
See Function


n


O


P

Package
A package is basically a directory to store files in. When writing large programs with many files, these are often used to separate different parts of the program into various directories. For example, if input and output is involved, all of the files that have to do with input and output could be put in an i/o package that could then be included in other files when they are needed via import statements.

Private
Private sections of code (or variables) may only be accessed by other portions of code in the same class.

Programming Language
A programming language is an artificial language that can be translated by a compiler or some other mechanism into a language that can be interpreted by a computer. It is basically an interface so that people can give instructions to a computer.

Public
When you see the word public, it means that the function or the variable that is being defined can be used by any other function, class or program. This is the opposite of private functions, which may only be accessed by other portions of code in the same class.


Q


R


S


String
A string is a variable type that stores text data. Strings are assigned values by either using an assignment statement to another String type variable or by putting quotation marks around the text that you want them to equal.

EXAMPLE:    String name = “Andrew”;

Syntax
Syntax refers to the way that Java is written. For example, Java and C++ are different languages because not only can they do different things, but their syntax is different. They have different ways of declaring arrays for example – i.e. their array declaration syntax is different.


T


U


V

Variable
A variable is a piece of data associated with a class or an object. A variable is the interface between the user and the data in the computer, a way for the user to call on that data.

Void
When you see the word void, it means that the function it is associated with does not return a value. Any void function has no value and can not be used like a variable like functions that return a value can.


w - z

While Loop
While loops are sections of code that are designed to be repeated as long as a certain condition is met. While loops need all four essential parts of a loop: initialization, test statement, update, and the loop body. In a while loop, the initialization happens before the loop. The test statement is the only thing in the parentheses after the word "while." The update portion of a while loop actually occurs within the loop body. While loops usually look like the code below:

int timesRolled = 0;

while(timesRolled < 4)
{
    RollDice();
    timesRolled++;
}