Java anatomy Flashcards

1
Q

What is this part called in a Java program…

class HelloWorld {
. . . .
}

A

Class definition

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

What is this part of a Java program called…

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

A

Main method

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

What type of java statement is this…
System.out.println(“Goodnight”);

A

Print statement

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

What type of Java statement is this…
int myInteger;

A

Variable declaration (for creating variables)

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

What type of Java statement is this…
myInteger = 65 + 6;

A

Assignment statement

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

What type of Java statement is this…
Import Java.util.Scanner;

A

Import statement

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

What is this part of a Java program…

public class Simple
{
public static void main(String[] args) <–
}
}

A

Method body

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

What are parentheses used for in a Java program…
()

A

They are used in a method header

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

What are braces used for in a Java program…
{

}

A

They are used to enclose a group of statements ie. content of a class or a method header.

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

In this context…
System.out.println(“Juneid Akoutam”);

The … class holds the … object, which is a member of the … class and the … method is a member of the … object.

A

System, out, System, println, out

Class= System
Object = out
Method = println

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

What does this escape sequence do:
\b

A

Causes the cursor to back or, or move left one position

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

What will the following statement print out…
System.out.println(“Hello my name is Juneid \rcock”);

A

Cock

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

What will the following statement print out:
System.out.println(“Hello my name is Juneid\b\b\bcock”);

A

Hello my name is Juncock

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

What is the purpose of the following escape sequence do:
'

A

Causes a singe quotation mark to be printed

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

What is the purpose of the following escape sequence
"

A

Causes a double quote mark to be printed

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

What is a variable

A

A named storage location in the computer’s memory

17
Q

What is a literal

A

A value that is written into the code of a program, it is a fixed value
ex:boolean

18
Q

True or false the first character of an identifier can be a digit

A

False

19
Q

True of false the first item of an identifier can be an underscore

A

True

20
Q

True or false an identifier can contain a space

A

False

21
Q

How many bytes does a short contain

A

2

22
Q

How many bytes do ints and floats contain

A

4

23
Q

How many bytes do doubles and longs contain

A

8

24
Q

True or false char literals are enclosed in single quote marks ex ‘a’

A

True