1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Q: What is a variable in Java?
A variable is a container that holds data that can be changed during program execution.
Q: What are the types of variables in Java?
Local variables, instance variables (non-static fields), and class variables (static fields).
Q: What is a data type?
A data type defines the kind of value a variable can hold, such as int, double, char, or boolean.
Q: What are the 8 primitive data types in Java?
byte, short, int, long, float, double, char, boolean
Q: What is the default value of an int, boolean, and reference type in Java?
int: 0, boolean: false, reference type: null
Q: What is the difference between primitive and reference data types?
Primitive types store actual values; reference types store memory addresses of objects.
Q: What is a literal in Java?
A literal is a fixed value assigned to a variable, like 5, 'A', or "Hello".
Q: What are arithmetic operators in Java?
+, -, *, /, %
Q: What are relational (comparison) operators in Java?
==, !=, >,
Q: What are logical operators in Java?
&& (AND), || (OR), ! (NOT)
Q: What is the difference between = and == in Java?
= is the assignment operator, == compares values (or references for objects).
Q: What is type casting in Java?
Converting one data type into another. Example: (int) 5.5 gives 5.
Q: What is the difference between implicit and explicit casting?
Implicit casting is automatic (e.g., int to double), explicit casting is manual using (type) syntax (e.g., double to int).