Skip to content
javabypankaj
HomeLibraryPopularCommunity
04
Exception Handling
10 topics · 28 questions
1Exception Handling Fundamentals0/442try-catch-finally0/443try-with-resources & Suppressed Exceptions0/224Custom Exceptions0/115Exception Chaining & Stack Traces0/446Exception Best Practices0/447Spring Exception Handling0/118Exceptions in Constructors & Static Init0/229Common Runtime Exceptions0/410JVM Exception Internals0/22
1Exception Handling Fundamentals42try-catch-finally43try-with-resources & Suppressed Exceptions24Custom Exceptions15Exception Chaining & Stack Traces46Exception Best Practices47Spring Exception Handling18Exceptions in Constructors & Static Init29Common Runtime Exceptions410JVM Exception Internals2
10 topics28 Qs0%
01Core Java17002OOP3203Collections6704Exception Handling2805Concurrency & Multithreading12706Java Streams, Lambda & Functional Programming32807Spring & Spring Boot2608Transactions3209JPA & Hibernate6910Microservices19411Kafka & Messaging9112DevOps, CI/CD & Tooling13313Database & SQL14114REST API & Web4015Design Patterns & LLD5716Advanced Java7117Coding Problems: DSA49218AWS & Cloud4119Data Engineering19420QA, Testing & SDET4121System Design3522Security2023Behavioral / HR: STAR Method37
10Topics
28Questions
0%Complete
9 of 10 topics
Topics
1Exception Handling Fundamentals0/442try-catch-finally0/443try-with-resources & Suppressed Exceptions0/224Custom Exceptions0/115Exception Chaining & Stack Traces0/446Exception Best Practices0/447Spring Exception Handling0/118Exceptions in Constructors & Static Init0/22
9Common Runtime Exceptions0/44
10JVM Exception Internals0/22

Common Runtime Exceptions

Exception Handling·Topic 9 of 10·4 questions
Q1What causes StackOverflowError?

StackOverflowError is caused by exhausting the per-thread call stack through unbounded recursion, while OutOfMemoryError is caused by exhausting the shared JVM heap through memory leaks or large data.

Read Answer
Q2What causes ClassCastException?

ClassCastException occurs when you cast an object to a type it is not, commonly from invalid downcasts, raw-type heap pollution, or toArray() misuse, and is prevented by instanceof checks and proper generics.

Read Answer
Q3What is IllegalArgumentException vs IllegalStateException?

IllegalArgumentException means the input is wrong (fix the argument), while IllegalStateException means the object's state is wrong (call at the right time), and the decision test is whether different arguments would fix the problem.

Read Answer
Q4What causes NoSuchElementException?

NoSuchElementException is thrown when asking for an element that does not exist, and is prevented by checking hasNext() before next(), using orElseThrow() instead of get(), and using poll()/peek() instead of remove()/element().

Read Answer
Previous · Topic 8Exceptions in Constructors & Static Init2 questionsNext · Topic 10JVM Exception Internals2 questions
javabypankaj© 2026 javabypankaj
PrivacyTerms
HomeSearchLibrary