A statically typed, object-oriented programming language compiled to bytecode that runs on a JVM.
2
New cards
[Java Overview] What are JDK, JRE and JVM?
JVM executes bytecode; JRE supplies the runtime; JDK includes tools such as javac for developing Java programs.
3
New cards
[Java Overview] What is the JIT compiler?
The Just-In-Time compiler translates frequently executed bytecode into native machine code at runtime.
4
New cards
[Java Overview] What is Java bytecode?
Platform-independent intermediate instructions produced by Java compilation and executed by a JVM.
5
New cards
[Java Overview] Why is Java called platform independent?
Compiled bytecode can run on compatible JVMs across operating systems.
6
New cards
[Java Overview] What does public static void main(String[] args) mean?
public makes it accessible, static allows class-level invocation, void returns nothing, main is the entry method, and args receives command-line arguments.
7
New cards
[Java Basics] What are primitive Java types?
byte, short, int, long, float, double, char and boolean.
8
New cards
[Java Basics] What is a wrapper class?
An object type representing a primitive, such as Integer for int and Boolean for boolean.
9
New cards
[Java Basics] What is autoboxing and unboxing?
Automatic conversion between primitives and corresponding wrapper objects.
10
New cards
[Java Basics] What is the difference between == and equals()?
== compares primitive values or object references; equals() can compare logical object content.
11
New cards
[Java Basics] Why is String immutable?
A String object's contents cannot change after creation; operations create new String values.
12
New cards
[Java Basics] What does static mean in Java?
A member belongs to the class rather than an individual instance.
13
New cards
[Java Basics] What does final mean?
A final variable cannot be reassigned, a final method cannot be overridden, and a final class cannot be extended.
14
New cards
[Java Basics] What is the difference between final, finally and finalize?
final is a modifier; finally is a cleanup block; finalize was an unreliable deprecated finalization mechanism.
15
New cards
[Java Basics] What is the difference between stack and heap?
Stack frames hold method-local execution state; the heap holds objects managed by garbage collection.
16
New cards
[Classes and Objects] What is a class?
A blueprint defining an object's fields, constructors and methods.
17
New cards
[Classes and Objects] What is an object?
A runtime instance of a class with identity, state and behavior.
18
New cards
[Classes and Objects] What is a constructor?
A special initializer invoked when creating an object, usually to establish valid initial state.
19
New cards
[Classes and Objects] What is constructor overloading?
Defining multiple constructors with different parameter lists.
20
New cards
[Classes and Objects] What is this in Java?
A reference to the current object, often used to distinguish instance fields from parameters.
21
New cards
[Classes and Objects] What is a singleton?
A design pattern ensuring only one instance of a class is available through controlled access.
22
New cards
[Classes and Objects] What are Java access modifiers?
public, protected, package-private and private control member visibility.
23
New cards
[Methods] What is method overloading?
Multiple methods share a name but differ in parameter types or counts; resolved at compile time.
24
New cards
[Methods] What is method overriding?
A subclass supplies a compatible implementation of an inherited instance method; selected dynamically.
25
New cards
[Methods] What is the difference between parameters and arguments?
Parameters are method declaration variables; arguments are values supplied at a call site.
26
New cards
[Methods] What is pass-by-value in Java?
Java passes copies of values, including copies of object references, to methods.
27
New cards
[Methods] What is a static method?
A method associated with the class and callable without an instance.
28
New cards
[Methods] Can static methods be overridden?
No; subclass static methods hide superclass methods rather than overriding them.
29
New cards
[Object-Oriented Programming] What are the four pillars of OOP?
Encapsulation, inheritance, polymorphism and abstraction.
30
New cards
[Object-Oriented Programming] What is encapsulation?
Bundling state and behavior and controlling access to internal implementation details.
31
New cards
[Object-Oriented Programming] What is inheritance?
A subclass extends a superclass to reuse and specialize accessible behavior.
32
New cards
[Object-Oriented Programming] What is polymorphism?
The same interface or method call can behave differently depending on the actual object type.
33
New cards
[Object-Oriented Programming] What is abstraction?
Exposing essential behavior while hiding implementation details.
34
New cards
[Object-Oriented Programming] What is an abstract class versus an interface?
An abstract class can hold shared state and implementation; an interface defines a contract and may include default or static methods.
35
New cards
[Object-Oriented Programming] Can Java classes extend multiple classes?
No; Java has single class inheritance, but a class can implement multiple interfaces.
36
New cards
[Object-Oriented Programming] What is the difference between composition and inheritance?
Composition builds behavior using contained objects; inheritance establishes an is-a relationship.
37
New cards
[Exceptions] What is an exception?
An object representing an abnormal condition that interrupts normal program execution.
38
New cards
[Exceptions] What are checked and unchecked exceptions?
Checked exceptions must be caught or declared; unchecked exceptions extend RuntimeException and need not be declared.
39
New cards
[Exceptions] How do try, catch and finally work?
try encloses risky code, catch handles matching exceptions, and finally generally runs cleanup logic.
40
New cards
[Exceptions] What is the difference between throw and throws?
throw raises an exception; throws declares possible exceptions in a method signature.
41
New cards
[Exceptions] How do you create a custom exception?
Define a class extending Exception for checked or RuntimeException for unchecked behavior.
42
New cards
[Exceptions] What is try-with-resources?
A try statement that automatically closes AutoCloseable resources when the block finishes.
43
New cards
[Exceptions] How do Error and Exception differ?
Errors generally signal serious JVM or system problems; exceptions represent conditions applications may handle.
44
New cards
[Java IO] What is Java I/O?
APIs for reading and writing bytes, characters and files.