CSA Unit 2: Using Objects

studied byStudied by 4 people
0.0(0)
Get a hint
Hint

Class

1 / 39

40 Terms

1

Class

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

New cards
2

Object

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

New cards
3

Instance

A created object with defined attributes.

New cards
4

State

The data that is associated with an object or class.

New cards
5

Behavior

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

New cards
6

Object Oriented Programming

The use of object and class types in programming.

New cards
7

String

input.nextLine()

New cards
8

int

input.nextInt()

New cards
9

double

input.nextDouble()

New cards
10

Method

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

New cards
11

Access Specifier

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

New cards
12

Return Type

Indicates what type value is being returned from the method.

New cards
13

Calling a Method

objectName.method()

New cards
14

Procedural Abstraction

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

New cards
15

Method overloading

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

New cards
16

return keyboard

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

New cards
17

Scope

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

New cards
18

String(String str) constructor

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

New cards
19

int length()

Returns the number of characters in a String object

New cards
20

String substring(int from, int to)

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

New cards
21

String substring(int from)

Returns substring(from, length())

New cards
22

IndexOutOfBoundsException

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

New cards
23

int indexOf(String str)

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

New cards
24

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.

New cards
25

Application Programming Interfaces

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

New cards
26

Documentation

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

New cards
27

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.

New cards
28

Integer and Double Classes

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

New cards
29

Integer.MIN_VALUE and Integer.MAX_VALUE

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

New cards
30

int intValue() and double doubleValue()

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

New cards
31

Autoboxing

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

New cards
32

Unboxing

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

New cards
33

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.

New cards
34

Math Class

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

New cards
35

int abs(int x)

Returns the absolute value of an int value.

New cards
36

double abs(double x)

Returns the absolute value of a double value.

New cards
37

double pow(double base, double exponent)

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

New cards
38

double sqrt(double x)

Returns the positive square root of a double value.

New cards
39

double random()

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

New cards
40

Math.random

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

New cards

Explore top notes

note Note
studied byStudied by 132 people
... ago
5.0(1)
note Note
studied byStudied by 55 people
... ago
4.5(2)
note Note
studied byStudied by 7 people
... ago
5.0(1)
note Note
studied byStudied by 30 people
... ago
5.0(1)
note Note
studied byStudied by 37 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 16 people
... ago
5.0(1)
note Note
studied byStudied by 23129 people
... ago
4.8(187)

Explore top flashcards

flashcards Flashcard (21)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (93)
studied byStudied by 13 people
... ago
5.0(2)
flashcards Flashcard (27)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (83)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (22)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (68)
studied byStudied by 29 people
... ago
5.0(2)
robot