CSA Unit 2: Using Objects

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/39

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards

Class

Classes are the template through which objects are created. It is the formal blueprint for creating objects.

2
New cards

Object

An object is a variable of a data type that is user defined. Every object has a state and a behavior.

3
New cards

Instance

A created object with defined attributes.

4
New cards

State

The data that is associated with an object or class.

5
New cards

Behavior

The actions that can be completed by an object or class.

6
New cards

Object Oriented Programming

The use of object and class types in programming.

7
New cards

String

input.nextLine()

8
New cards

int

input.nextInt()

9
New cards

double

input.nextDouble()

10
New cards

Method

Procedures that allow us to control and define the behavior of an object.

11
New cards

Access Specifier

Determines who has access to using the method when writing classes and objects.

12
New cards

Return Type

Indicates what type value is being returned from the method.

13
New cards

Calling a Method

objectName.method()

14
New cards

Procedural Abstraction

The ability to use methods and programs that we do not fully understand, or are unable to write.

15
New cards

Method overloading

Methods can have multiple signatures. Java will use the correct signature based on the actual parameters used in a program.

16
New cards

return keyboard

Used to return a value back to the main program from a method.

17
New cards

Scope

Defines which part of the program a variable can be accessed from.

18
New cards

String(String str) constructor

Constructs a new String object that represents the same sequence of characters as str

19
New cards

int length()

Returns the number of characters in a String object

20
New cards

String substring(int from, int to)

Returns the substring beginning at index from and ending at index to − 1

21
New cards

String substring(int from)

Returns substring(from, length())

22
New cards

IndexOutOfBoundsException

A String object has index values from 0 to length – 1. Attempting to access indices outside this range will result in this error.

23
New cards

int indexOf(String str)

Returns the index of the first occurrence of str; returns -1 if not found.

24
New cards

int compareTo(String other)

Returns a value < 0 if this is less than other; returns zero if this is equal to other; returns a value > 0 if this is greater than other.

25
New cards

Application Programming Interfaces

APIs and libraries simplify complex programming tasks by providing sets of clearly defined methods of communication among various computing components.

26
New cards

Documentation

Documentation is the reference for how to use different methods and classes.

27
New cards

Integer(int value) and Double(double value)

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

28
New cards

Integer and Double Classes

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

29
New cards

Integer.MIN_VALUE and Integer.MAX_VALUE

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

30
New cards

int intValue() and double doubleValue()

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

31
New cards

Autoboxing

Automatic conversion between primitive types and their corresponding object wrapper classes.

32
New cards

Unboxing

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

33
New cards

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.

34
New cards

Math Class

The Math class is part of the java.lang package and contains only static methods.

35
New cards

int abs(int x)

Returns the absolute value of an int value.

36
New cards

double abs(double x)

Returns the absolute value of a double value.

37
New cards

double pow(double base, double exponent)

Returns the value of the first parameter raised to the power of the second parameter.

38
New cards

double sqrt(double x)

Returns the positive square root of a double value.

39
New cards

double random()

Returns a double value greater than or equal to 0.0 and less than 1.0.

40
New cards

Math.random

Can be manipulated to produce a random int or double in a defined range.