1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is Java?
Java is a high-level, object-oriented programming language designed to be platform-independent through the Java Virtual Machine (JVM) and is widely used for enterprise-scale and mobile applications.
What are the main features of Java?
Java's main features include Object-Oriented: everything is an object; Platform-Independent: runs on any machine via JVM; Multithreaded: supports multithreaded programming; Robust: manages memory automatically and provides error handling.
What is Object-Oriented Programming (OOP)?
OOP is a programming style based on objects which contain data and code. Key principles include Encapsulation, Inheritance, Polymorphism, and Abstraction.
Encapsulation
The concept of wrapping data and methods that operate on that data within a single unit or class in OOP.
Inheritance
A mechanism in OOP where one class can inherit fields and methods from another class.
Polymorphism
The ability in OOP to process objects differently based on their data type or class.
Abstraction
The concept of hiding complex implementation details and showing only the necessary features of an object.
What is the difference between JDK, JRE, and JVM?
JDK is the software development kit that includes JRE, compilers, and developer tools. JRE provides libraries and JVM to run Java applications. JVM is the engine that executes Java code.
Heap Memory
Used for dynamic memory allocation for Java objects and JRE classes.
Stack Memory
Stores local variables and function call information for methods.
Method Area
Stores class structures like metadata, constant runtime pool, and method code.
Program Counter (PC) Register
Contains the address of the JVM instruction currently being executed.
Native Method Stack
Contains all native method information used in a Java application.
How do == and equals() differ?
== checks if two references point to the same memory location, while equals() checks for equivalence based on object content.
What is an Exception in Java?
An exception is an event disrupting the normal flow of a program, classified as Checked (e.g., IOException) or Unchecked exceptions (e.g., NullPointerException).
Checked Exceptions
Exceptions checked at compile-time, requiring handling (e.g., IOException, SQLException).
Unchecked Exceptions
Exceptions checked at runtime, typically related to logic errors (e.g., NullPointerException).
What is the final keyword?
In Java, final can be used with variables (cannot be changed), methods (cannot be overridden), and classes (cannot be subclassed).
What is the purpose of the static keyword?
The static keyword indicates that a member belongs to the type itself, allowing shared variables and methods accessible without an instance.
Garbage Collection in Java
The process of reclaiming unused memory automatically by the JVM, preventing memory leaks and optimizing performance.