Unit 2: Using Objects

Cards (30)

  • Class: the template through which objects are created. It is the formal blueprint for creating objects.
  • Object: An object is a variable of a data type that is user defined. Every object has a state and a behavior.
  • State: The data that is associated with an object or class.
  • Object Oriented Programming: The use of object and class types in programming.
  • Instance Variables: Used to store the state, or data of the object instances.
  • Constructor/Signature: Allows for the creation of a new object. Consists of the constructor name and parameter list.
  • Instantiate
    Create an instance of a class object.
  • null: A keyword that indicates a reference object doesn't point to any object data.
  • Overloading: When a class has more than one constructor with the same name, but different parameter lists.
  • Access Specifier: Determines who has access to using the method when writing classes and objects.
  • Return Type: Indicates what type value is being returned from the method
  • Calling a Method
    objectName.method()
  • Procedural Abstraction: The ability to use methods and programs that we do not fully understand, or are unable to write.
  • Method overloading: Methods can have multiple signatures. Java will use the correct signature based on the actual parameters used in a program.
  • Multiple parameters: The order matters when there are multiple parameters
  • return keyword: Used to return a value back to the main program from a method.
  • Scope: Defines which part of the program a variable can be accessed from.
  • Immutable: Unable to be changed or manipulated. String are immutable.
  • Implicit Conversion: The automatic process of transforming a variables data type. This occurs when a primitive and String object are concatenated by changing the primitive value to a String object type.
  • Escape Sequences: Enable users to use special characters and actions within String objects.
  • Integer and Double Classes: These classes are part of the java.lang package and Object class and have a number of useful methods.
  • Autoboxing: Automatic conversion between primitive types and their corresponding object wrapper classes
  • Unboxing: Reverse of autoboxing; automatic conversion from the wrapper class to the primitive type
  • Static Methods: Static methods are the methods in Java that can be called without creating an object of class. Static methods are called using the dot operator along with the class name unless they are defined in the enclosing class.
  • Math Class: The Math class is part of the java.lang package and contains only static methods.
  • double sqrt(double x): Returns the positive square root of a double value
  • Math.random: Can be manipulated to produce a random int or double in a defined range.
  • Why do we use methods in Java? To make code easier to understand
    To avoid repeated code
    To simplify code
  • Formal Parameters: the parameters outlined in the parameter list in the constructor
  • Actual Parameters: the parameters that are input when a new instance of a class object is created.