Java Article 2 - Definitions

For people new to programming, it is hard to find simple definitions for a lot of programming terms. I am trying to keep this as simple as possible, while at the same time add some value to typical text-book definitions. This article will be updated as needed to cover future java articles. If you are new to programming, you should understand terms like variable and other basic math terms or learning programming is going to be really hard.

Abstract Class: An abstract class is a class that cannot be instantiated, but can be subclassed. Abstract classes may include (but don't have to) abstract methods. If a class does contain an abstract method then it must be declared abstract. Classes are declared abstract by adding the abstract modifier to the class declaration.

Abstract method:An abstract method is a method that is declared without an implementation (without any statements, or put another way without braces. example:

abstract void myAbstractClass();

Argument: An argument is some data you pass to a method. The method then does something with the data.

The about is an oversimplified definition. A more text-book definition would be: An argument is an identifier in a method call that is sent to the method. Programmers refer to this as "passing" (sending) the argument to the method.

In this definition see how easy it is to get flooded by new terms? Well take your time and look up identifier, method and method call below then come back.

So an example of an argument (listed as "anArgument" below) would looks like this:

someMethod (int anArgument);

So we are telling someMethod to take anArgument and "do its thing" (execute). Many times the method will do some calculations with the argument it was sent.

In real life it's a bit like handing your friend a thumb drive with the number six in text file and asking him to figure out the number you gave him times 2.

Block of code: When programmers talk about a block of code it often just means a section of code or a group of statements. Code block can also mean the collection of lines of code following an if statement.

Class: The blueprint for an object. As a convenience, Classes can also act like objects performing some function. Classes and objects are what define object oriented programming. A class is often one file on your computer but it doesn't have to be.

Class Declaration: Contains the class name, and information about the class such as access modifiers, the class name, the classes superclass (if it has one) and any interfaces it may implement. The class declaration encloses the class body in braces.

Identifier: An identifier is the name we give a variable to identify it.

So in declaring a variable (basically telling the computer that you want to make a variable) you give it an identifier. Below is an example with myIdentifier being the name of the variable:

public int myIdentifier = 32;

Remember algebra where X = Y + 2? Well X and Y are Identifiers that hold the variable (in this example the numbers). They can be said to identify the variable.

Method: Methods are the basic working parts of a class. They do the work the software was written to do. A method consists of a method header (the title of the method including method modifiers, and parameters.)

I know the above just got very complex if you are new to programming. For now just think of a method as a name for a collection of instructions. Ever hear the expression "Time for plan B." Well plan B is a method name that has some steps in it.

Method Call: A line of code that tells (calls) a method to execute.

Object: An object is created (instantiated) from a class. It is helpful to think of Objects as physical things. So if your class is a blueprint, then your object would be something created from a blueprint like a car. Objects and classes will be discussed more in Java Article 3.

Parameter: The terms Argument and Parameter are often used interchangeably in conversation or on the web. In languages like Java and C# they both refer to a data associated with a method.

A text-book definition would be: A parameter is what appears in a method name as an incoming identifier. Wow another mouthful of jargon.

So this is an example a parameter would look like this, with the parameter named "aParameter":

public void someMethod (string aParameter) {


Statement: a line of code that does something. Methods are made up of one or more statements. Statements are the basic building block of a program.

In the real world you could think of a method as being a recipe. Well a statement is just one step such as "cook at 375 degrees C" or "Add 4g carrots to the pot."

Static Method: I will add more to this later, but think of the static modifier in a method as telling the compiler to expect this method to come from a class and not an object.

Static Variable: Per Oracle: "Fields that have the static modifier in their declaration are called static fields or class variables. They are associated with the class, rather than with any object. Every instance of the class shares a class variable, which is in one fixed location in memory. Any object can change the value of a class variable, but class variables can also be manipulated without creating an instance of the class."

Variables: a name given to data, for the purpose of allowing the name to be used independently of the information it represents. It also represents a location in computer memory that holds the data.

Int myInt; //this is a simple declaration

Int myOtherint = 6; // this is a declaration and assignment. Assignment is also referred to as initialization when you are assigning a value to a variable for the first time. Variables in a class are called fields or class fields or static fields.

Variables in a object (an instance of class) are typically called instance variables or attributes. You can call them i-vars if you want to be really cool.

Variables in a method or block of code are called local variables.

Variables in method declarations are called parameters.

Variables sent to a method declarations are called arguments.

These definitions are all you will need for the next article. This page will be updated with more definitions as new Java articles are released.