SLU CMPS161 Test 1
Operators
+, -, *, /, %
Two Import Statemets
Specific and Wildcard import. The specific import specifies a single class and imports it; the wildcard imports all classes in a package.
Memory
Stores data and program instructions for the CPU to execute. A memory unit is stored in a sequence of bytes. Memory is volatile.
Programming errors
Syntax, runtime, and logic. Errors reported by the compiler are syntax or compile errors. Runtime errors are errors that cause the program to terminate abnormally. Logic errors occur when a program does not perform the way it was intended to.
Computer Programming
The writing instructions (i.e. code) for computers to perform
Four integer types
Byte, short, int, long
UNIX Epoch
January 1, 1970
Computer's two stable states
zeros and ones
Increment and decrement
(++) and (--) increase or decrease a variable by 1.
Integer arithmetic
(/) Yields an integer result
CPU
(Central Processing Unit) is a computer's brain. It receives instructions from memory and executes them
Augumented Assignment Operators
+=, -=, *=, /=, and %=
Machine Language
A set of primitive instructions built into every computer
Casting
A variable of a small type to a larger range is known as widening a type. The opposite is known as narrowing a type. Widening a type may be performed automatically without explicit casting. Narrowing a type must be performed explicitly.
High-level languages
Are English-like and easy to learn and program. A program written in (blank)-level language is called a source program.
Identifiers
Are names for naming elements such as variables, constants, methods, classes, packages in a program
Variables
Are used to store data in a program. To declare a (blank) is to tell the compiler what type of data a variable can hold.
Bit
Binary digit of 0 and 1
Java source code is...
CASE SENSITIVE
Software
Computer programs that are the invisable instructions that control the hardware and make it perform tasks
Assignment operator
Equal sign (=)
.class extension
Every class is compiled into a separate byte-code file that had the same name as the class and ends with... To run a (blank) from the command line, use the java command.
Statement
Everyone ends with a semicolon (;) also known as the (blank) terminator
(Type) Value
Explicitly convert a value of one type to another
Two floating-point types
Float and double
Reserved words or keywords
Have a specific meaning to the compiler and cannot be used for other purposes in the program
Assembly Language
Is a low-level programming language in which mnemonic is used to represent each machine-language instruction
Operating System (OS)
Is a program that manages and controls a computer's activities
Compiler
Is a software program that translates the source program into machine-language program
Java
Is platform independent, meaning that you can write a program once and run it on any computer. (blank) programs can be embedded in HTML pages and downloaded by Web browsers to bring live animation and interaction to Web clients
Java source file
Name must match the public class name in the program. (blanks) must end with the .java extension. To compile from the command-line, use the javac command
Order used in Java
PEMDAS
Hardware
Physical aspect of the computer that can be touched
Named constant
Represents permanent data that never changes. Declared by using the variable final.
Identifier Criteria
Sequence of charcters that consists of letters, digits, underscores, and dollar signs. An identifier must start with a letter or underscore. It cannot start with a digit. An identifier cannot be a reserved word. An identifier can be of any lengt.
Comments
When preceded by two slashes- line comment. Enclosed between /* and */ - paragraph comment or block comment.
Storage devices
Where programs and data are permanently stored, but are moved to memory when the computer actually uses them
Methods are contained in...
a class. To run a Java program, the program must have a main method. The main method is the entry point where the program starts when it is executed
Block
begins with an opening brace { and ends with a closing brace }
Byte
is a sequence of 8 bits
Kilobyte (and other conversions)
is about 1,000 bytes, a megabyte about 1 million bytes, a gigabyte about 1 billion bytes, and a terabyte, about 1,000 gigabytes
A Variable declared in a method...
must be assigned a value before it can be used.