1/77
Para sa Quiz on Tuesday Source from w3school From Java Intro to Data types
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is Java?
A high-level, object-oriented programming language.
Who developed Java?
Originally by Sun Microsystems, now owned by Oracle.
What is JVM?
Java Virtual Machine — runs Java bytecode on any platform.
What is JDK?
Java Development Kit — includes compiler, JVM, and tools.
What is JRE?
Java Runtime Environment — includes JVM and libraries to run Java apps.
What is bytecode?
Intermediate code compiled from Java source, executed by JVM.
Why is Java platform-independent?
Because bytecode runs on any JVM regardless of OS.
What is an IDE?
Integrated Development Environment — e.g., IntelliJ, Eclipse.
What file extension does Java source use?
.java
What command compiles Java code?
javac MyClass.java
What is the entry point of a Java program?
public static void main(String[] args)
How do you print text in Java?
System.out.println("Hello");
What symbol ends a statement?
; (semicolon)
How are code blocks defined?
{} (open and closed curly brackets)
Is Java case-sensitive?
Yes
Can class names start with a number?
No
What keyword defines a class?
class
What keyword creates an object?
new
What is a constructor?
A method used to initialize objects.
Can a class have multiple constructors?
Yes, via constructor overloading.
Single-line comment syntax?
// comment
Multi-line comment syntax?
/* comment */
No
Do comments affect execution?
Can comments be nested?
No
Why use comments?
To explain code and improve readability.
What is a variable?
A container for storing data
How to declare an integer variable?
int x = 10;
Can variable names contain spaces?
No
What is initialization?
Assigning a value during declaration.
Can variables be reassigned?
Yes, unless declared final
.
What is a constant?
A variable whose value cannot change.
How to declare a constant?
final int MAX = 100;
What is camelCase?
Naming convention where first word is lowercase, others capitalized
Naming convention where first word is lowercase, others capitalized
No
Can variable names contain special characters?
Only _
and $
are allowed.
How many primitive types are there?
8
What does byte
store?
-128 to 127
What does short
store?
-32,768 to 32,767
What does int
store?
-2,147,483,648 to 2,147,483,647
What does long
store?
-9 quintillion to 9 quintillion
What does float
store?
~6–7 decimal digits
What does double
store?
~15–16 decimal digits
What does Boolean
store?
true
or false
What does char
store?
A single character
Default value of int
?
0
Default value of boolean
?
false
Default value of char
?
'\u0000'
Default value of float
?
0.0f
Default value of double
?
0.0d
Default value of long
?
0L
How to declare a float
?
float f = 5.99f;
How to declare a double
?
double d = 19.99;
How to declare a char
?
char c = 'A';
How to declare a boolean
?
boolean b = true;
How to declare a long
?
long l = 123456789L;
What is a non-primitive type?
A type that refers to objects.
Examples of non-primitive types?
String
, Array
, Class
Can non-primitive types be null?
Yes
Can primitive types be null?
No
Is String
a primitive type?
No
Can non-primitive types have methods?
Yes
How to declare a String
?
String s = "Hello";
Can you use new
with String
?
Yes: String s = new String("Hello");
What is the default value of String
?
null
Can you compare strings with ==
? (More Advanced)
Not reliably — use .equals()
instead.
What is type casting?
Converting one data type into another.
What is implicit casting?
Automatic conversion from smaller to larger type.
What is explicit casting?
Manual conversion using (type)
syntax.
How to cast double
to int
?
int x = (int) 9.99;
What is the purpose of data types?
To define the kind of data a variable can hold
Other Types
char
Boolean
Floating-Point Types
float
double
Java Primitive Data Types
Integer Types
byte
short
int
long
Floating-Point Types
float
double
Other Types
char
Boolean
Integer Types
byte
short
int
long