APCSA Unit 1 - Primitive Types

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

How do you start a java code?

1 / 53

54 Terms

1

How do you start a java code?

public static void main (String [] args)

New cards
2

What is a statement in java? Give an example.

A complete argument in java. Example: System.out.print(“literal”);

New cards
3

What is a class in Java? Give an example.

A template that associates and creates objects that share common properties and methods. Your public class must match the name of the file with a .java extention. Example: public class MyClass

New cards
4

What is a keyword in Java? Give an example.

A word reserved by java to run code. Example: if, public, and class

New cards
5

How do you make comments in java?

With two slashes (//) or with a slash and an asterisk and a backslash and an asterisk (/**/)

New cards
6

What is a variable?

A name associated with a memory location in the computer where you can create a value to change or vary.

New cards
7

Give an example of how to combine literals and variables and have the computer print both.

System.out.print (“base: “ + base);

New cards
8

Give an example on how to declare a variable only.

int a

New cards
9

Give an example on how to set an initial value for a variable only.

a = 4

New cards
10

Give an example of how to set a variable and give it a variable.

int a = 4

New cards
11

What is an int variable?

Interger (math variable)

New cards
12

What is a double variable?

Decimal (math variable)

New cards
13

What is a String variable?

A variable that includes quotes and string text

New cards
14

What is a boolean variable?

A variable that can only be True or False

New cards
15

How do you find the answer of a decimal problem in decimals in java?

Use the primitive variable double and include decimal points in any number included.

New cards
16

List all the math operators.

+,-,*,/,and %

New cards
17

What are compound operators? List them.

Operators that use two math symbols. -- subtracts one, ++ adds one, a+=2 would set a to a + 2.

New cards
18

What does / do in java?

Divides two numbers and gives an integer answer (no remainder)

New cards
19

What does % do in java?

Gives only the remainder of a division problem.

New cards
20

What are the types of variables?

Primitive and object or reference variables

New cards
21

What are the primitive variable types in java?

int, double, string, boolean

New cards
22

What is the string variable used for?

Secquences of charectes

New cards
23

How many bits does a boolean variable use?

1

New cards
24

What is the string concatenation operator?

+

New cards
25

What does final do in java?

stops a variable from being changed

New cards
26

What is camel case?

When you uppercase the first letter

New cards
27

What is an assign statement?

A statement that changes the value

New cards
28

What is this operator called %?

Modulo

New cards
29

What is 11 % 10 saying?

What is the remainder of how many times 10 goes into 11?

New cards
30

Does the division operator drop the decimal after dividing?

Yes, no rounding

New cards
31

Variable

A name associated with a memory location in the computer.

New cards
32

boolean

used to declare a variable that can only have the value true or false.

New cards
33

double

used to declare a variable that is a decimal number like 3.25.

New cards
34

int

used to declare a variable of type integer (a whole number like -3 or 235).

New cards
35

static

means that the field or method exists in the object that defines the class.

New cards
36

compiler

Software that translates the Java source code into the Java class file that can be run.

New cards
37

compiler or syntax error

An error or bug that is found by the compiler like a missing semicolon

New cards
38

Main Method

Where execution starts in a Java program.

New cards
39

Boolean

An expression that is either true or false.

New cards
40

Camel Case

One way to create a variable name by appending several words together and uppercasing the first letter of each word after the first word (myScore).

New cards
41

Casting a Variable

Changing the type of a variable using (type) name.

New cards
42

System.out.println()

Java method that lets us print out a line of output followed by a newline to the user

New cards
43

Declare a Variable

Specifying the type and name for a variable. This sets aside memory for a variable of that type and associates the name with that memory location.

New cards
44

Initializing a Variable

The first time you set the value of a variable.

New cards
45

String literal

Text enclosed by double quotes.

New cards
46

modulo

The % operator which returns the remainder from one number divide by another.

New cards
47

Operator

Common mathematical symbols such as + for addition and * for multiplication.

New cards
48

Shortcut or compound assignment operators

Operators like x++ or x+= 1 which mean x = x + 1

New cards
49

assignment statements

initialize or change the value stored in a variable using the assignment operator =.

New cards
50

data type

determines the size of memory reserved for a variable, for example int, double, boolean, String.

New cards
51

ArithmeticException

If you divide by zero, you will get this error.

New cards
52

operator precedence

Some operators are done before others, for example *, /, % have precedence over + and -, unless parentheses are used.

New cards
53

arithmetic expression

a sequence of operands and operators that describe a calculation to be performed, for example 3*(2 + x)

New cards
54

increment operator

The operator (++) that increases the value of a numerical variable by one.

New cards

Explore top notes

note Note
studied byStudied by 9190 people
... ago
4.8(30)
note Note
studied byStudied by 183 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 11 people
... ago
5.0(1)
note Note
studied byStudied by 26 people
... ago
5.0(1)
note Note
studied byStudied by 79 people
... ago
4.8(4)
note Note
studied byStudied by 14 people
... ago
5.0(1)
note Note
studied byStudied by 21 people
... ago
5.0(2)

Explore top flashcards

flashcards Flashcard (43)
studied byStudied by 14 people
... ago
5.0(1)
flashcards Flashcard (70)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (40)
studied byStudied by 23 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 16 people
... ago
5.0(1)
flashcards Flashcard (47)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (29)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (86)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (108)
studied byStudied by 19 people
... ago
5.0(1)
robot