Syntax Flashcards

Learn about Java syntax (grammar)

1
Q

What is a semicolon ( ; ) used for?

A

To end a Statement.

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

What are curly braces/brackets for? ( { } )

A

They are for grouping blocks of code, whether it’s a part of a class, method, or conditional statement.

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

What should every Java source code file (generally) start with?

A
Defining a class.
Ex. public class ClassName
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does // mean?

A

A single line comment. The compiler ignores this line.

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

What does /* */ represent?

A

A block comment, it is used to comment out a block of code. It can also be used on a single line.

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

What method should (generally) be present in a Java program?

A

The ‘main’ method. This is the entry point into the program.

Ex. public static void main(String[] args)

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

What should always come in pairs?

A

Parentheses, braces and quotation marks.

( ) [ ] { } “ “ ‘ ‘

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

How is whitespace treated by the compiler?

A

It is ignored. Unless it is within two double quotation marks.

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