Unit 2: Using Objects Flashcards
abs(int a)
A function used to find and return the absolute value (magnitude) of an integer. It disregards any negative sign attached to it and always gives back its positive equivalent.
Abstraction
The process of simplifying complex systems by focusing on essential features while hiding unnecessary details. It allows programmers to work with high-level concepts without worrying about implementation specifics.
Assignment operator
Used to assign a value to a variable. It is represented by the equals sign (=) and it assigns the value on the right side of the equals sign to the variable on the left side.
Classes
User-defined data types in object-oriented programming. They serve as blueprints for creating objects by defining their attributes and methods.
Constructor
A special method within a class that is used to initialize objects of that class. It is called automatically when an object is created and helps set initial values for its attributes.
Encapsulation
Refers to the bundling of data and methods within a class, where the data is hidden from external access. It ensures that an object’s internal state remains consistent by controlling how it can be accessed or modified.
IllegalArgumentException
An exception that occurs when a method receives an argument that is inappropriate or invalid for its intended purpose. It usually indicates that there was an error in how arguments were passed into a method.
indexOf(String str)
A method used to find the index position of the first occurrence of a specified substring within a larger string.
Inheritance
A concept in object-oriented programming where a class inherits the properties and behaviors of another class. It allows for code reuse and promotes the creation of hierarchical relationships between classes.
Return type (void)
In programming refers to the data type of the value that a method or function returns. In the case of “void,” it means that the method does not return any value.
length()
A method used to find the number of characters in a string.
Math class
A class in Java that provides various mathematical operations and functions that can be performed on numeric data types. It includes methods for basic arithmetic operations, trigonometry, logarithms, random numbers generation, etc.
Math.PI
A constant in the Math object of JavaScript that represents the ratio of the circumference of a circle to its diameter. It is approximately equal to 3.14159.
Methods
Functions defined within a class that perform specific tasks or actions when called upon by an object. They can manipulate data, interact with other objects, or return values.
Null keyword
A special value in programming that represents the absence of a value. It is often used to indicate that a variable does not currently have any assigned value.
Object-oriented programming (OOP)
A programming paradigm that organizes code into objects, which are instances of classes. It emphasizes the use of objects to represent real-world entities and their interactions.
Objects
Instances of a class that represent real-world entities or concepts. They encapsulate data (attributes) and behavior (methods) into a single entity.
Overloading constructors
Refers to the ability to have multiple constructors in a class, each with a different set of parameters. This allows objects to be created with different initial states or configurations.
Parameters
Variables declared in a method or function that receive values when the method is called. They allow data to be passed into a method, enabling it to perform actions or calculations based on those values.
Polymorphism
Refers to the ability of objects to take on multiple forms or have multiple types. In programming, it allows different objects to be treated as instances of a common superclass, enabling flexibility and extensibility.
pow(double a, double b)
A function that is used to raise a number (a) to the power of another number (b). It returns the result of a raised to the power of b.
Primitive data types
Basic data types that are built into a programming language and represent simple values. They include integers, floating-point numbers, characters, booleans, and more.
random()
A function that generates and returns a pseudo-random decimal value between 0.0 (inclusive) and 1.0 (exclusive).
Reference types
Data types in programming that store references or memory addresses rather than the actual values themselves. They include objects, arrays, and strings, and allow for dynamic memory allocation and manipulation.
sqrt(double a)
A function that calculates and returns the square root of a given number (a).
substring(int beginIndex, int endIndex)
A method that is used to extract a portion of a string based on the specified beginning and ending indexes. It returns a new string that contains the characters from the original string within the given range.
substring(int beginIndex)
A method that is used to extract part of an existing string starting from the specified beginning index up to (but not including) the end of the original string.
Class
A blueprint or template for creating objects in object-oriented programming. It defines the properties and behaviors that an object of that class will have.
Instance Variables
Variables declared within a class but outside any method. They hold unique values for each instance (object) of the class and define the state or characteristics of an object.
Object-Oriented Programming
A programming paradigm that organizes code into objects, which are instances of classes. It focuses on creating reusable and modular code by encapsulating data and behavior together.
Reference Type
A data type that stores the memory address of an object rather than the actual value. It allows multiple variables to refer to the same object, and changes made to one variable will affect all other variables referencing that object.
System.out.println
A Java statement used to display output on the console. It prints the specified message or value and adds a new line character at the end.
Constructor Overloading
A feature in OOP that allows multiple constructors with different parameter lists within a single class. Each constructor can initialize an object with different sets of values.
Object
An instance of a class that encapsulates data and behavior. It represents a real-world entity or concept in the program.
New Keyword
Used in Java to create an instance (object) of a class. It allocates memory for the object and initializes its attributes using the constructor method.
NullPointerException
Occurs when a program tries to access or use an object that has not been initialized, meaning it is currently set to “null”.
Parameter List
A set of input parameters/arguments that are passed to a method or constructor when it is called. It specifies the type and order of the values that need to be provided for the method/constructor to execute correctly.
Pass-by-value language
Refers to programming languages where copies of variable values are passed into functions. Any changes made to these copies do not affect the original variables.
Primitive value
A basic data type in programming that represents simple pieces of information such as numbers or characters.
Method
A named sequence of instructions that can be called or invoked to perform a specific task or action. Methods are used for code reusability, organization, and abstraction.
Non-Static Methods
Functions or procedures that belong to an object and can only be accessed through an instance of the class. They can modify the state of an object and are not associated with a specific class.