Looks like no one added any tags here yet for you.
Symbol(s) used to add a comment
//
Identifiers
Names that are given to show data that are stored in the memory of a computer when a program is being executed in a computer
Logical error
An error because of the incorrect way a code is structured.
Run-time error
A compiler doesn’t catch this error. It just causes an error with the execution of the program.
Print statement
System.out.print("");
Code to assign value to identifier
type identifier = value;
Primitive data
Basic types of data
Integer (int)
It represents any number that is an integer. All positive, negative numbers and zero. Cannot store decimals.
Double
A number that can be positive, negative, or zero, and it can be a fraction or decimal.
Boolean
A value that is either true or false. True = 1, False = 0 in machine code.
Character (char)
It represents a single character that can be represented on a computer. It includes any character that you type on the keyboard. Stored with the use of single quotation marks or an apostrophe.
Modulus operator
% - Returns the remainder once two numbers are divided.
Casting
A process in which data is forced to look like another type of data to the compiler.
Casting double to an int
int x;
double y = 4.5;
x = (int) y;
Casting int to a double
int x = 4;
double y;
y = (double) x;
Increment operator
(++) This increases the value of a number by one.
Decrement operator
(--) This decreases the value of a number by one.
a += b
a = a + b
a -= b
a = a - b
Object
A data type created in Java.
String
An object data type which has a class with many methods that describe the behavior of an object.
Immutable class
Once an object is created, the assigned value cannot change.
Object
data type created in Java
Class
used to build objects
“if” statement
conditional statement that is used in Java to help control the flow of the program
Boolean Operator
==
Logical And
&&
Logical Or
||
Not Equal To
!=
DeMorgan’s Law
to simplify common compound conditions, distribute the ! into the parenthesis and change the && to ||, or vice versa
while loop
loop cycles through again and again, while the condition is considered true
infinite loop
loop that repeats forever because of condition
for loop
statement 1 is executed (one time) before the execution of the code block.
statement 2 defines the condition for executing the code block.
statement 3 is executed (every time) after the code block has been executed.
class
when a group of statements, such as control structures, are all put together to be referred to this
method
group of code that performs specific task
object class
This class houses the “guts” of the methods that the driver class calls.
header
defines method function
constructor
sets object’s initial values for instance variables
instance variables
attributes in a class, also known as fields
precondition
a comment that is intended to inform the user more about the condition of the method and guarantees it to be true.
postcondition
a condition that must always be true just after the execution of a section of code, or after an operation in a formal specification.
aggregate class
Made up of other data, and instances of other classes.
static variable
attribute that is shared among all instances of a class
arrays
a data structure that makes it easier to handle similar types of data
sequential searches
These search through the data one by one in order, and take a long time to execute
binary searches
These search through the data for the desirable value by dividing it into half each time until the desired value is found
sorting algorithms
They take data in an array, and rearrange it into a particular order. They are very powerful because they can accomplish tasks faster, and can make your programs even more efficient.
selection sort
This sort searches and swaps. Once it finds the lowest value, it will swap its position in the array with the data at index 0. The first element is now sorted. The process repeated for index 1. The rest of the array will be searched for the lowest value and is swapped with the data that is found at index 1.
insertion sort
It compares the first 2 elements, and depending on the outcome of this it inserts the second value in front of the first value into index 0, which moves the first value to index 1. The first 2 elements are sorted. Then the third element is checked and this process continues until it’s entirely sorted.
merge sort
This type of sort uses recursion. An array is split into 2 pieces. The piece is sorted. The 2 sorted pieces are merged together into one sorted list. Then in order to sort each of the 2 pieces, the same method is used again until it is fully sorted.
array lists
A huge limitation of arrays is that it has a fixed length, and can only store, one specific type of data.
dynamically sized
used to describe an array list which becomes bigger / smaller as elements are added / removed
2D array
array within an array, like a vending machine
inheritance
A way to create a relationship amongst classes.
inheritance hierarchy
A way to determine how information travels amongst the classes. Ex: The subclasses inherit characteristics of the parent class.
multiple inheritance
when a class has more than 1 superclass, it is defined as ______. not allowed in java
overridden
new version of code takes over old version
polymorphism
When many classes are related to each other by inheritance. Inheritance lets us inherit attributes and methods from another class. uses those methods to perform different tasks.
recursive call
characteristic to call a method itself
base case
Signal the execution to stop the recursion and return to each prior recursive call