(int)(x+0.5)
Rounds the value of a double to the nearest whole number
Primitive Type
Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean)
Abstract Class
A class, usually at the top of a Class Hierarchy, that cannot be instantiated, because not all of its methods are defined.
Abstract method
Methods added to the abstract classes, that is not defined. the word (abstract) must come before the method’s return type.
Access Specifier
Determines who has access to using the method when writing classes and objects.
Accessor Method
A method that enables user to obtain information about an object’s instance and static variables. Usually refered as getter method
Algorithm
An algorithm is a set of steps or rules to follow to solve a particular problem.
Assigning to a variable
Updating the variable values. The variable is already declared. Setter methods do this
Attributes of on object
Object characteristics. Also called Instance variables
Behavior
The actions that can be completed by an abject or a class. Also called Class Methods/ Instance methods.
Boolean
A Java type that can either be true or false. It is also a Primitive.
Break
Breaks out of a while loop and executes statements that immediately follow while loop
Calling Method
objectName.method() → Calling a method
Char
is a java type that represents a single character
Casting
Turning something of one type into anther type
Class
Classes are template through which objects are created. It is the formal blueprint for creating objects. Every program starts with a class
Class Hierarchy
Class hierarchy refers to the arrangement of classes and how they relate to each other.
Client
When someone creates a class (like String, or Randomizer), and you are using the functionality of that Class in your program, your program is a client of the class. You are using the class as a client.
Compile Time Error
An error in the actual Jaava code. The code will not compile into an excutable program.
Concatenation
The process of adding two string valuables together.
Contractor
Special method of a class that constracts a new object. Sets the initial values.
Declare Variable
Defining variable for the first time
Define Method
Defining a method means to teach the computer a new command and explain what it should do when receiving that command.
Double
Jave type that represents
Encapsulation
The process of hiding the implementation details of a class from the user
Exception
Thrown by java when a runtime error is encountered.
For Loop
Repeats code a fixed number of times
Getter method
An instance method that allows the client to get the value of an instance variable on an object.
If Statements
if (boolean expression) { //execute statements if condition is true }
Immutable
Unable to be changed or manipulated. String are immutable.
Infinite loop
Occurs when the expression in a while loop never evaluates to false. The program continues to run infinitely.
Inheritance
When a subclass extends a superclass, the subclass inherits all of the static methods, static variables, and public instance methods of the superclass. This is called inheritance.
Initialize a Variable
Initializing a variable is giving it an initial value, or a starting value.
Instance
Create an instance of a class object.
Instance Methods
An instance method is a method that defines the behavior of an object. It defines an action that the object can perform.
Instance Variable
Used to store the state, or data of the object instances.
Int
int
is a Java type that represents an integer (a whole number)
Local Variable
A variable that is defined in a method or constructor. It only exist in the context of the method that it belongs to.
Loop-and-a-half
A loop, most often set with while(true)
, that has a break
statement in the loop body.
Method
Procedures that allow us to control and define the behavior of an object.
Method Overloading
Classes can have multiple methods with the same name, as long as the parameters to those methods are different. Doing this is called "overloading" a method.
Method Overriding
If a subclass defines a new method body for a method defined in the superclass, then the subclass has overridden the method of the superclass.
Mutator Method
A method that enables user to change the value of an object’s instance and static variables.
OR
Methods used to change or manipulate instance variable or object data. Also referred to as setter methods.
New
Necessary keyword for instantiating a new class object.
Object
An object is a variable of a data type that is user defined. Every object has a state and a behavior.
Object Oriented Programming
Programming model that focuses on objects and the data and actions associated with the objects.
Parameter
A variable passed into a method from outside the method.
Polymorphism
An object can take on different forms depending on its implementation. Java can call the correct method even when an object is disguised as a more generic reference type
Primitive Types
Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean)
Private
Restricts access to data and methods to the declaring class.
Public
Allows access to data and methods from classes outside the declaring class.
Return
Keyword used in methods to return a value back to the initial program that called the method.
Return Type
The return
statement exits a method and returns a value.
Return Value
The value returned from a method
Runtime Error
An error that happens while the program is running. Even if the code is written with the proper syntax, there are things that can go wrong while the program is running.
Scope
Defines which part of the program a variable can be accessed from.
Sentinel
A constant that has the specific purpose of being the value that breaks out of a loop.
Setter method
An instance method that allows the client to set the value of an instance variable on an object.
Shadowing
If two variables within the same scope have the same name, the variable with the more specific scope will be called.
State
The state of an object is all of the object's associated data. It is the state that the object is in. The data that is associated with an object or class.
Static method
A method called on the Class, rather than on a specific object of the Class.
Static Variable
A variable or attribute of a class that is shared between all instance of a class. Each instance does not get their own copy.
String
String is a Java type that represents a string of characters (text)
Subclass
A child class that inherits attributes and behaviors from a superclass (parent).
Super
The super
keyword lets us reference the superclass when writing code inside of a subclass.
Superclass
A parent class that contains common attributes and behaviors used by subclasses (children).
this
The this
keyword is a reference to the current object (the current instance).
toString
A specific accessor method that returns a String value with information about an object’s instance values. This overrides the object’s inherit toString method when an object is printed using System.out.print or System.out.println
Variable
A symbol or container that holds a value.