Java Flashcards

1
Q

what is the Java equivalent to DISPLAY?

A

System.out.println(…);

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

how do you display a String?

A

“___”

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

how do you compile a code?

A

javac (class name).java

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

how do you execute a code?

A

java (class name)

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

how do you make a comment?

A

// your comments here

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

what are the types of variables?

A
char
String
boolean
int
double
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how do you write character types?

A

char x = ‘A’;

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

how do you write strings?

A

String “example”;

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

how do you write integers?

A

int exampleOne = 3;

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

how do you start a code?

A
public class (class name){
     public static void main(String[] args){
          // code here
     }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are the primitive data types?

A

char
boolean
int
double

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

what is camel-case?

A

start variable with a lowercase and then every new word starts with a capital letter

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

what are the compound assignment operators?

A
\+= (adds to variable)
-= (subtracts from variable)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how do you turn an argument from a string into an integer or a double?

A

Integer.parseInt (args [0] )

Double.parseDouble [args [1] )

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

how do you write and, or, and not?

A

&&
||
!

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

what type is args[ ]?

A

String

17
Q

how do you turn args [ ] into an integer or a double?

A

Integer.parseInt(args[ ]);

Double.parseDouble(args[ ]);

18
Q

when do you NOT put a semicolon at the end of a line?

A

IFs and loops

19
Q

what is a FOR loop and why is it used?

A

an alternative to a WHILE loop but it is more compact

20
Q

how do you stop a never ending loop in the terminal?

A

Ctrl + C

21
Q

what does BREAK do?

A

jumps out of the loop or it quits the loop

22
Q

what does CONTINUE do?

A

skips the rest of the statements of the current loop iteration, continues with the next iteration