Module 1: Basics Flashcards

1
Q

What is a statement?

A

A line of code used to perform a task, it must end with a semicolon.

Ex:

{System.out.println(“This is a statement”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the starting point of a java program?

A

The main method.

public static void main(String[] args) {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the variable types?

A

String (Text)

byte (Whole numbers to 127)

int (Whole numbers to 2147483647)

short (Whole numbers to 32767)

long (Whole numbers to 9223372036854775807) add L after value.

double (Decimals) [Slower, More memory but more precise]

float (Decimals) [Faster, Less memory but not as accurate] add f after value.

char (Single character) requires single quotes.

boolean (True or false)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a comment?

A

Annotations of what the code is doing, they are not executed.

Ex:

// Single line comment

/* Multi line
comment */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is scope?

A

Variables can only be used after the line they were created in, not above. If a variable was created in a code block, it cannot be used once the block ends.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly