Flashcards · Java · Free
Java flashcards, generated for you.
Example Java study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Java flashcards
What is the difference between '==' and '.equals()' when comparing strings in Java?
'==' compares object references (memory addresses); '.equals()' compares actual string content. Always use '.equals()' for string content comparison.
What does 'null' mean in Java, and what happens if you call a method on a null reference?
'null' is the absence of a value/object. Calling any method on null throws a NullPointerException (NPE) at runtime.
Explain the difference between primitive types and reference types in Java.
Primitives (int, boolean, double, etc.) store values directly on the stack; reference types (objects, arrays, strings) store a memory address on the stack pointing to data on the heap.
What is the difference between pass-by-value and how Java handles it for objects?
Java is always pass-by-value. For primitives, the value copies; for objects, the reference (address) copies. Modifying object fields inside a method affects the original; reassigning the reference parameter does not.
What is the difference between final, finally, and finalize in Java?
'final' is a modifier preventing reassignment (variables) or overriding (methods/classes); 'finally' is a block that always executes in try-catch-finally; 'finalize()' is a deprecated method called before garbage collection.
How do static variables and instance variables differ in memory and behavior?
Static variables are shared across all instances of a class, stored once in memory; instance variables are created per object instance. Static variables exist even without object instantiation.
What is the difference between ArrayList and arrays, and when would you use each?
Arrays are fixed-size, type-specific, and store contiguous memory; ArrayLists are dynamic, resizable, and slower. Use arrays for fixed-size data; use ArrayList when size changes frequently.
Explain what happens with auto-boxing and auto-unboxing in Java, and name a potential gotcha.
Auto-boxing converts primitives to wrapper objects (int→Integer); auto-unboxing reverses it (Integer→int). Gotcha: unboxing a null Integer throws NullPointerException, not a default value.
What is the difference between checked and unchecked exceptions, and which must be caught?
Checked exceptions (IOException, SQLException) must be caught or declared in method signature; unchecked exceptions (RuntimeException, NullPointerException) are optional. Checked enforced at compile-time.
What does 'this' keyword mean, and what is the difference between 'this' and 'super'?
'this' refers to the current object instance; 'super' refers to the parent class. Use 'this' to access current class members or call another constructor; use 'super' to access parent class members or call parent constructor.
Make your own Java study set
Flashcards for related topics
Studying Java to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →