Please enable JavaScript to use CodeHS

Texas CS 2 Glossary

Flashcards

Course:

Module:

Lesson:

Search:

Class Java

A class is a template, or a blueprint, from which Java objects are created. All Java programs start with a class.

Object Java

An object is a single instance of a Java class. An object has both state and behavior.

Object Oriented Programming Java

Programming model that focuses on **objects** and the data and actions associated with the objects.

State Java

The state of an object is all of the object's associated data. It is the *state* that the object is in.

Behavior Java

The behavior of an object is what the object is able to do. It is the actions that can be performed by the object.

Instance Java

Instance is what you call a specific object constructed from a class. Instance and object generally refer to the same thing. An object is a specific instance of a class.

Client Java

When someone else 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.

Method Java

A method is a way to teach the computer a new command

String Java

String is a Java type that represents a string of characters (text)

Instance Variable Java

A variable defined in a Class, for which each object of the class has its own copy.

Constructor Java

A constructor is a special method of a Class that constructs a new object (a new instance) of the Class and sets the initial values for the instance variables.

toString Java

toString is a special method you write in your class that returns a String representation of the object.

Parameter Java

A variable that receives a value passed into a method from outside the method.

Return type Java

A method's return type is the type of value returned from that method.

Method signature Java

A method's signature is the name of the method and the parameter list.

Instance Method Java

An instance method is a method that defines the behavior of an object. It defines an action that the object can perform.

Visibility Java

Visibility (usually `public` or `private`) defines who has access to something (usually a variable or method). Public means code outside of the class can access, private means only code inside the class can access.

Static method Java

A method called on the Class, rather than on a specific object of the Class.

Static variable Java

A variable or attribute of a class that is shared between **all** instance of a class. Each instance **does not** get their own copy.

Package Java

Related classes are grouped together into packages.

this Java

The `this` keyword is a reference to the current object (the current instance).

Class Hierarchy Java

Class hierarchy refers to the arrangement of classes and how they relate to each other.

Inheritance Java

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.

Abstract Class Java

A class, usually at the top of a Class Hierarchy, that cannot be instantiated, because not all of its methods are defined.

Abstract method Java

A method, written in an Abstract Class, that is not defined. The word `abstract` must come right before the method's return type. It is up to the subclass to fill in the definition for the abstract method.

Method body Java

The part of the method that contains the commands

Method Overriding Java

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.

Interface Java

An interface provides a list of methods that *must* be defined if a class chooses to implement the interface.

Comparable Interface Java

The Comparable Interface is a standard interface in Java that mandates that all classes implementing the Comparable interface must define a method called `int compareTo(Object o)` that returns a positive int if the parameter `o` passed in is *less than* the current instance, returns 0 if it is equal, and a negative int if it is greater.

Polymorphism Java

Polymorphism is the capability of a method to do different things depending on which object it is acting upon.

Dynamic Binding Java

Also called late binding, this refers to Java choosing the proper method to call at run time, as opposed to at compile time.

Subclass Java

If a class A extends the class B, then A is a subclass of B.

Superclass Java

If a class A extends the class B, then B is the superclass of A.

super Java

The `super` keyword lets us reference the superclass when writing code inside of a subclass.

Scope General

In what part of the program the variable exits

Scope

Local variable General

A variable that is restricted to use in a certain scope of a program

Local variable

Primitive Type Java

Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean)

Getter Method Java

An instance method that allows the client to **get** the value of an instance variable on an object.

Setter Method Java

An instance method that allows the client to **set** the value of an instance variable on an object.

Method Overloading Java

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.

Variable Shadowing General

If two variables have the same name, and exist inside of the same scope, the variable with the *more specific* scope takes precedence. This is called shadowing. Local variables and parameters shadow the more general global variables (instance variables).

Variable Java

A symbol or container that holds a value.

Pointer Java

When an object is assigned to a variable, the variable doesn't hold all of the object's data, it only holds a *pointer* to the object's data. The variable holds a memory location (think of it as a pointer to that memory location), and the object data is stored at that memory location.

Null Pointer Java

Before an object variable is initialized, it doesn't point to any memory. It holds a **null pointer**.

ACM Java

Association for Computing Machinery: organization for computing professionals to provide guidance related to ethics and responsibilities.

System reliability Java

When all programs and code will work as intended.

Bias Java

Prejudice in favor of or against one thing, person, or group compared with another, usually in a way considered to be unfair.

Integer and Double Classes Java

These classes are part of the java.lang package and Object class and have a number of useful methods.

Integer(int value) and Double(double value) Java

Constructs a new Integer object or a new Double Object that represents the specified int or double value

Integer.MIN_VALUE and Integer.MAX_VALUE Java

The minimum/maximum value represented by an int or Integer, which are -2147483648 and 2147483647

int intValue() and double doubleValue() Java

Returns the value of this Integer as an int and this Double as a double

Autoboxing Java

Automatic conversion between primitive types and their corresponding object wrapper classes

Unboxing Java

Reverse of autoboxing; automatic conversion from the wrapper class to the primitive type

Object Superclass Java

The Object class is the superclass of all other classes in Java.

composition Java

a way to create complex objects by combining simpler objects together, representing a “has-a” relationship between objects