stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Basics Flashcards | StudBud
Explore
/
Java Basics
Java Basics
15 terms
·
StudBud Administration
·
12 plays
Test your knowledge on fundamental concepts of Java programming
Flashcards
15 cards
F
Practice quiz
P
Host live
L
Questions
15
Answers
1
What is the correct way to declare an integer variable?
Value int;
integer value;
int value;
var int = value;
2
True or false: String literals can span multiple lines.
False
True
3
Which is NOT an arithmetic operator in Java?
+
*
&&
%
4
True or false: Java variable names are case-sensitive.
False
True
5
What is the syntax for multiple integer variables?
var int x, y, z;
int x y z;
integer x = 5, y = 10, z = 15;
int x = 5, y = 10, z = 15;
6
True or false: Local variables get default values if uninitialized.
False
True
7
What does System.exit(0); do?
Exits the Java program successfully
Throws an error
Logs out the user
Stops the compilation
8
Which is a valid Java reserved keyword?
varname
integer
define
final
9
How to declare a float variable correctly?
float num = "12.34";
float num = 12.34F;
float num = 12.34;
float num: 12.34;
10
True or false: System.out.println can only print numbers.
True
False
11
What will be the output of System.out.println("The value is: " + 5);?
The value is:
5
The value is: 5
Error
12
Which is NOT a valid Java identifier?
_myVariable
$amount
1stVariable
myVariable1
13
What is the output of System.out.println(1 / 2);?
1/2
0
Error
0.5
14
What does the + operator do with a string?
Causes an error
Ignores the operand
Performs addition
Performs string concatenation
15
True or false: A variable can be reassigned after declaration.
True
False