Java anatomy Flashcards
What is this part called in a Java program…
class HelloWorld {
. . . .
}
Class definition
What is this part of a Java program called…
public static void main(String[ ] args) {
. . . .
}
Main method
What type of java statement is this…
System.out.println(“Goodnight”);
Print statement
What type of Java statement is this…
int myInteger;
Variable declaration (for creating variables)
What type of Java statement is this…
myInteger = 65 + 6;
Assignment statement
What type of Java statement is this…
Import Java.util.Scanner;
Import statement
What is this part of a Java program…
public class Simple
{
public static void main(String[] args) <–
}
}
Method body
What are parentheses used for in a Java program…
()
They are used in a method header
What are braces used for in a Java program…
{
}
They are used to enclose a group of statements ie. content of a class or a method header.
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.
System, out, System, println, out
Class= System
Object = out
Method = println
What does this escape sequence do:
\b
Causes the cursor to back or, or move left one position
What will the following statement print out…
System.out.println(“Hello my name is Juneid \rcock”);
Cock
What will the following statement print out:
System.out.println(“Hello my name is Juneid\b\b\bcock”);
Hello my name is Juncock
What is the purpose of the following escape sequence do:
'
Causes a singe quotation mark to be printed
What is the purpose of the following escape sequence
"
Causes a double quote mark to be printed