APComp Sci CH4

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

a final variable

A final variable is a variable that cannot be changed once it is assigned a value. It is typically used to represent constants in a program. it can be accessed with an accessor method, meaning its declared from the method. SYNTAX EXAMPLE: Object.method()

2
New cards

a static final variable

a static final variable is a variable that cannot be changed once assigned a value. It can be accessed without the need for an accessor method, so it's declared from the class. when used as an instance variable, the access specifier would be public. SYNTAX EXAMPLE: Class.method()

3
New cards

overflow

overflow occurs when the result of a calculation exceeds the range for a number type. ex, when trying to solve an overflow with the int type, use long instead

4
New cards

rounding errors

Mistakes that occur when approximating a number. They happen due to limitations in representing real numbers in a computer's finite memory. Rounding errors can accumulate and affect the accuracy of calculations.

5
New cards

primitive types

Basic data types in programming languages. Include integers, floating-point numbers, characters, and booleans. Represent simple values and have predefined sizes. Stored directly in memory and accessed quickly. Cannot be further divided or modified. Examples: int, float, char, bool.

6
New cards

number literals

Numeric values used to represent specific numbers in programming. They can be written directly in the code without any calculations or variables. Examples include integers (e.g., 5), floating-point numbers (e.g., 3.14), and exponential notation (e.g., 1e3 for 1000).

7
New cards

square root method in a Math class

Math.sqrt(x). Mathematical Representation: square root of x

8
New cards

power method in a Math class

Math.pow(x, n). Mathematical representation: x^n

9
New cards

When I divide by a demical, the result doesnt have to be a decimal: true or false?

false

10
New cards

when I divide by an integer, the result would be an integer: true or false

true

11
New cards

the % operator in java

Java operator used to calculate the remainder of a division operation. Returns the remainder when one number is divided by another.

12
New cards

I can initialize an int with a double: true or false?

false

13
New cards

static methods

methods that can be declared with no need of an object reference. EXAMPLE: Class.method()

14
New cards

Prompt

a print message that prompts the user on what to place in the import

15
New cards

the statement for the prompt could be println or printf, it doesn't always have to be print: true or false?

false

16
New cards

System.in

takes in input from the user. can be combined with the Scanner class to be useful

17
New cards

Scanner Object SYNTAX

Scanner in = new Scanner(System.in);

18
New cards

nextInt method

reads a int imput

19
New cards

NextDouble method

reads a float-point value

20
New cards

Next method

reads a string with a single word, not multiple

21
New cards

the best way to format a numerical answer would use what print statement?

the printf statement

22
New cards

string

A sequence of characters

23
New cards

character

a value of the type char

24
New cards

Single quotes are for _____ while double quotes are for ______

Char; String

25
New cards

The position number of the last character is always ________ than the length of the string

One less

26
New cards

charAt()

Returns the character at the specified index

27
New cards

string literal

text enclosed in quotes

28
New cards

empty string

The string "", which contains no characters and has a length of zero.