COP2800 : Java Programming Chapter 1

A First Program Using Java

1) Machine language: most basic circuitry of level of language.

2) High-level language: It allows you to use a vocabulary of reasonable Terms.

3) Syntax: Is the rules of the language.

4) Complier: It translates high-level language statements into machine code.

5) Logic: executing the various statements and procedures in a correct order to produce the desired results.

6) Procedural Programming: involves using your knowledge of Programming language to create computer memory locations that can hold values and writing a series of steps or operations that manipulate those values.

7) Variable: A memory locations that hold values that might vary.

8) Procedures: They define the variable memory locations, then calls or invokes a series of procedure to input, manipulate, and output the values stored in those location. A single procedural program often contains hundreds of variables and thousands of procedural calls.

9) Object-oriented Programming (OOP): An extension of procedural programming in which you take a slightly different approach to writing computer programs. It involves both creating objects and creating application that use those objects.

10) States of an object: also are known as its attributes.
Example: Car has make, model, yr, and price.

11) Instance: that object.

12) Class: The fundamental unit of Java code.
Example: class Name 1st letter of the name of a class is Uppercase.
A class name must begin with a letter of the alphabet (which include symbols for alpha, etc.)
The class that defines the attributes and methods of a car would be named Car.
Classes are application components that hold executable code and data.

13) Methods: they exist for ascertaining certain attributes, such as the current speed of a Car and the current status of its gas tank. Method names usually are referenced followed by their parentheses, as in println(), so you can distinguish method names from variable names.
method names should start lowercase: println();
If more than 1 word name, start each name after the 1st with uppercase: oneExample().

14) Encapsulation: The technique of packaging an object's attributes into a cohesive unit that you can use as an undivided entity. Programmers sometimes refer to encapsulation as using a "black box" or a device that you can use without regard to the internal mechanisms.

15) Interpreter: A special program to translate the program for the host machine.

16) Bytecode: A program written in the Java programming language is compiled into JVM code.
The complied bytecode is subsequently interpreted on the machine where the program is executed. Any compiled program will run on any machine that has a java programming language interpreter.

17) Literal String: It is a series of characters that will appear exactly as entered.

18) Arguments: Consist of information that a method requires to perform its task.
Example: System.out.println ("Hello !");
"Hello !" is the argument.

19) Dots: used to separate the names of the class, object, and method.
Example: System.out.println();
It is: Class.object.method();

20) Important Keywords:

Reserved Keywords:
abstract float protected
boolean for public
break for public
break future rest
byte generic return
byvalue of short
case implements static
cast import super
catch inner switch
char instanceof synchronized
class int this
continue interface throw
do native transient
double new try
else operator var
extends outer void
final package volatile
finally private while

Reserved words that are not Keywords
true false null

Keywords used as Class Modifiers
abstract final public

Keywords used as Method Modifiers
abstract final public
protected private static
synchronized native  

The Java programming language is based on Unicode, which is an international system of character representation.
Java is case sensitive.

21) Access Modifier: It defines the circumstances under which a class can be accessed.

22) Method Header: example: public static void main (String[] args) where main is the method.

23) static: It means there is only 1 copy that lives in a class and is shared by all instances of that class.

24) void: It does not return any value when it is called.
It doesn't mean that it doesn't produce any output, but it does not send any value back to any method that might use it.

25) Syntax error: is a programming error that occurs when you introduce typing errors into your program.

Back to the Top


Chapter 1 - A First Program Using Java Section B : Using Data

1) Constant: A data value that does not change.

2) Variable: A data value that might change.
Variable names usually begin with lowercase letters to distinguish variable names from class names. However, variables may begin with upper or lower case. Java is case sensitive.

3) Variable declaration: A data type, a identifier (name), a optional assigned value, and a ending semicolon.
Example: int myAge = 25;
data type = int,
identifier = myAge,
assigned value = 25;

4) Assignment operator: = the equal sign.

5) Initialization: An assignment when you declare a variable;
an assignment made later is simply an assignment.

6) Primitive types:

Type bits Number of bytes
byte 8 1
short 16 2
int 32 4
long 64 8
float 32 4
double 64 8
boolean 1  
char 16 2

7) Unifying types: When you perform arithmetic operations with operands of unlike types, java chooses a unifying type for the result. Java then implicitly (or automatically) converts nonconforming operands to the unifying types. You can explicitly (or purposely) override the unifying type imposed by Java by performing a type cast.

8) Type cast: It involves placing the desired result type in parentheses fallowed by the variable or constant to be cast. (page 36)
Example: int dollars = (int) weeklyBudget;

9) Escape sequence: \ the back slash to include a nonprinting character.
Example: \b= backspace, \t=tab, \n=newline, \f= feed form, \c= carrage return.

Back to the Top


Links to COP2800 Java Programming Chapters:
Links to the java.sun.com to help with Java Programming

Back to the Top