/
AI Flashcards
Save to my account
Sign up
AI Flashcards
Java Fundamentals Flashcards
Study
1
Question
What file extension do Java source code files use?
Page 1
Answer
.java
2
Question
What file extension do compiled Java files use?
Page 1
Answer
.class
3
Question
What does 'syntax' refer to in Java programming?
Page 1
Answer
The grammar rules of the programming language
4
Question
What is an 'object' in Java?
Page 1
Answer
An instance of a class on which methods can be called
5
Question
What does 'instantiation' mean in Java?
Page 1
Answer
The process of creating an object based on a class
6
Question
What is a 'variable' in Java?
Page 1
Answer
A named memory location for storing data that can change during execution
7
Question
What is the purpose of the 'final' keyword in Java?
Page 1
Answer
Used to declare a constant
8
Question
What does an 'import' statement do in Java?
Page 1
Answer
Declares that a Java file will use an external class
9
Question
What is a 'method' in Java?
Page 1
Answer
A set of Java statements that perform a task when defined in a class
10
Question
In the import statement 'import java.util.Scanner;', what is the package?
Page 1
Answer
java.util
11
Question
In the import statement 'import java.util.Scanner;', what is the class?
Page 1
Answer
Scanner
12
Question
What is wrong with 'Scanner console = new Scanner(10);'?
Page 1
Answer
Should use System.in instead of 10 for input
13
Question
What is missing in 'System.out.println("Enter your age: ")'?
Page 1
Answer
Semicolon (;) at the end
14
Question
What method should be used to read an integer from Scanner?
Page 1
Answer
nextInt()
15
Question
Name a primitive type used in Java for characters.
Page 2
Answer
char
16
Question
Name a primitive type used in Java for whole numbers.
Page 2
Answer
int
17
Question
Name a primitive type used in Java for decimal numbers.
Page 2
Answer
double
18
Question
What class is used for reading console input in Java?
Page 2
Answer
Scanner
19
Question
What class might be used for GUI labels in Java?
Page 2
Answer
GLabel
20
Question
Which declaration correctly initializes a String with double quotes?
Page 2
Answer
String saying = "We will see snow soon";
21
Question
Why is 'String name = 'Angie';' incorrect?
Page 2
Answer
Uses single quotes instead of double quotes for String
22
Question
Which declaration correctly initializes a char variable?
Page 2
Answer
char letter = 'A';
23
Question
Why is 'char letter = "A";' wrong?
Page 2
Answer
Double quotes are for Strings, not chars
24
Question
How does Java escape a backslash in a print statement?
Page 2
Answer
Use \\ to print \
25
Question
How does Java print double quotes inside a string?
Page 2
Answer
Use \" to print "
26
Question
What does \n do in a Java print statement?
Page 2
Answer
Inserts a newline
27
Question
What is the result of 3 % 2 in Java?
Page 2
Answer
1
28
Question
What is the result of 2 % 2 in Java?
Page 2
Answer
0
29
Question
What is the result of 3 > 2 in Java?
Page 2
Answer
true
30
Question
What is the result of 3 / 2 in integer division in Java?
Page 2
Answer
1