| Author |
compile time vs runtime error???
|
Shashank Sharma
Ranch Hand
Joined: Sep 27, 2006
Posts: 91
|
|
|
Hey can anybody please explain me how do i figure the error gonna be compile time or runtime (obj 5.2)
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
Usually the exam tests to see if you recognize checked exceptions that lead to compile time errors and runtime exceptions that lead to runtime errors. Any exception that extends from the Exception class is a checked exception. Any exception that extends from the RuntimeException is a runtime exception. With more practice you should be able to differentiate between the two
|
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
What John writes about is the difference between checked and unchecked exceptions; that is not the same as runtime vs. compile time errors. Compile time errors are errors in your source code, that the compiler will give an error message about. Syntax errors and other errors in your source code are compile time errors. Runtime errors are errors that happen later, when you run your program.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Shashank Sharma
Ranch Hand
Joined: Sep 27, 2006
Posts: 91
|
|
|
isnt there any fix rule that what makes error to be thrown at run time or at compile time..like NoSuchMethod is thown at compile time..
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
I may be comming in a little late on the discussion, but I hope this contrubution adds to the discussion. I have a little set of mock exam questions on this subject that tries to drive home when something won't compile, when an Exception will get thrown, and when a RuntimeException might get thrown. I put the mock exam questions in a new JavaRanch thread so as not to hijack this one: Mock SCJP 6.0 Exam Questions on Execptions vs. Compile Errors vs. Just Good Code! You can see the original posting at my blog if you're interested. -Cameron McKenzie [ July 21, 2008: Message edited by: Cameron Wallace McKenzie ]
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
Originally posted by Shashank Sharma: like NoSuchMethod is thown at compile time..
No, it isn't. Exceptions are never thrown at compile time. And NoSuchMethodError is an exception that could happen at runtime.
|
 |
 |
|
|
subject: compile time vs runtime error???
|
|
|