Code Syntax - 1 - Flashcards

1
Q

Ouput

A

System.out.println(“ “);

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

First statement to start the program

A

public class <class_name>{
public static void main(String[] args){</class_name>

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

Single-line Comment

A

//Comments…..

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

Multi-line Comment

A

/* Comments
Comments
Comments*/

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

Declare a variable

A

<data_type> <variable_name>;

<data_type> <variable_name> = <value>;

We should end the value with L for long , F for float, and D for double
</value></variable_name></data_type></variable_name></data_type>

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

Widening Casting

A

converting a smaller type to a larger type size byte -> short -> char -> int -> long -> float -> double

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

Narrowing Casting

A

onverting a smaller type to a larger type size
double -> float -> long -> int -> char -> short -> byte

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

Switch

A

switch (x)
{
case a:
code block
break;
case b:
code block
break;
default:
code block
break;
}

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

Java break/continue

A

“Break” is used to stop the loop when it meets thecondition
“Continue” is used to skip one iteration of the loop and then continue the loop till the end.

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

Array declartion

A

<data_type>[] <variable_name>;

<variable_name> = new <data_type>[length];

<data_type>[] <variable_name> = new <data_type> [length];
</data_type></variable_name></data_type></data_type></variable_name></variable_name></data_type>

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

Array initialization

A

<data_type>[] <variable_name> = {a[1], a[2], a[3],...};
</variable_name></data_type>

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

2D-array declaration

A

<data_type>[][] <variable_name>;<variable_name> = new <data_type>[length][length];

<data_type>[] <variable_name> = new <data_type> [length][length];
</data_type></variable_name></data_type></data_type></variable_name></variable_name></data_type>

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