aspose file tools*
The moose likes Beginning Java and the fly likes How Many types Of Errors in java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How Many types Of Errors in java ?" Watch "How Many types Of Errors in java ?" New topic
Author

How Many types Of Errors in java ?

Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 216

Some One asked me that , How many types of Errors are there in java ?
I replied, Only one.
am I wrong ?


OCPJP 6 86%
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4388
    
    8

It depends what you mean by the question. There are several Error classes for example, including: StackOverflowError, AssertionError, OutOfMemoryError. Is that the sort of error you're talking about?
Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 216

Matthew Brown wrote:It depends what you mean by the question. There are several Error classes for example, including: StackOverflowError, AssertionError, OutOfMemoryError. Is that the sort of error you're talking about?

I already posted the Full Question. I know the question is incomplete but just tell me a appropriate answer based on the information available.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11313
    
  16

I agree with Matt - the question is vague at best.

edit - I would say the correct answer would be "Could you elaborate on what you mean by 'errors in java'".


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4388
    
    8

Based on the information available, we can't say if you were right or wrong. I think I could come up with interpretations where the answer would be 1, 2, 3, lots or "unlimited".

Depending on context, I'd either ask for clarification or say "assuming that you mean ..., then the answer is ...". When you said the answer was "one", what did you think the question meant?
Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 216

fred rosenberger wrote:I agree with Matt - the question is vague at best.

edit - I would say the correct answer would be "Could you elaborate on what you mean by 'errors in java'".


""Could you elaborate on what you mean by 'errors in java'""
Wow fred this was exactly what i said to her.
And she replied with a smile that what about compile time errors ?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Nikhil Sagar wrote:
Matthew Brown wrote:It depends what you mean by the question. There are several Error classes for example, including: StackOverflowError, AssertionError, OutOfMemoryError. Is that the sort of error you're talking about?

I already posted the Full Question. I know the question is incomplete but just tell me a appropriate answer based on the information available.


The appropriate answer is some version of, "Please clarify the question."
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Nikhil Sagar wrote:
fred rosenberger wrote:I agree with Matt - the question is vague at best.

edit - I would say the correct answer would be "Could you elaborate on what you mean by 'errors in java'".


""Could you elaborate on what you mean by 'errors in java'""
Wow fred this was exactly what i said to her.
And she replied with a smile that what about compile time errors ?


Sounds like she's not a very good interviewer and is more interested in showing how clever she is than in actually engaging in a discussion with you to get a feel for your level of understanding of Java.
Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 216

Jeff Verdegan wrote:
Nikhil Sagar wrote:
fred rosenberger wrote:I agree with Matt - the question is vague at best.

edit - I would say the correct answer would be "Could you elaborate on what you mean by 'errors in java'".


""Could you elaborate on what you mean by 'errors in java'""
Wow fred this was exactly what i said to her.
And she replied with a smile that what about compile time errors ?


Sounds like she's not a very good interviewer and is more interested in showing how clever she is than in actually engaging in a discussion with you to get a feel for your level of understanding of Java.

Agree Jeff, but in future if someone tell me that compile time errors are also errors in java, because many books use the line compile time errors.
But i realize that "compile time errors" is a wrong statement because in SCJP6 by K&B, authors never use "compile time error" they always use "compiler complains".
Is that correct ??
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Nikhil Sagar wrote:[
Agree Jeff, but in future if someone tell me that compile time errors are also errors in java, because many books use the line compile time errors.


Well, yes, compile-time errors are a "type of error in Java." This is true. But when someone simply asks a vague, meaningless question like "How many types of errors are there in Java?" it's impossible to know what he means and what he's looking for without some clarification.

But i realize that "compile time errors" is a wrong statement because in SCJP6 by K&B, authors never use "compile time error" they always use "compiler complains".


No, it's not wrong. And K&B is not the ultimate authority on Java terminology. The JLS is. People use the phrase "compile-time errors" all the time, and although it may not be part of the official terminology from the JLS, it's in common use and everybody knows what it means. The term is not wrong in and of itself, and it's not wrong to say that compile-time errors are a type of error you can get in Java.

Now, having said that, there are contexts where it would be wrong, if the question was clearer. For example, if the question had been, "How many types of exception are there in Java", then "compile-time exception" is not correct. There is no such thing, especially in the sense that most people use it, where they seem to think that unchecked exceptions are "compile-time" exceptions. I understand where that thinking comes from, and there's a certain logic behind it, but it goes against the standard terminology, and it leads to confusion.
Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 216

Jeff Verdegan wrote:
Nikhil Sagar wrote:[
Agree Jeff, but in future if someone tell me that compile time errors are also errors in java, because many books use the line compile time errors.


Well, yes, compile-time errors are a "type of error in Java." This is true. But when someone simply asks a vague, meaningless question like "How many types of errors are there in Java?" it's impossible to know what he means and what he's looking for without some clarification.

But i realize that "compile time errors" is a wrong statement because in SCJP6 by K&B, authors never use "compile time error" they always use "compiler complains".


No, it's not wrong. And K&B is not the ultimate authority on Java terminology. The JLS is. People use the phrase "compile-time errors" all the time, and although it may not be part of the official terminology from the JLS, it's in common use and everybody knows what it means. The term is not wrong in and of itself, and it's not wrong to say that compile-time errors are a type of error you can get in Java.

Now, having said that, there are contexts where it would be wrong, if the question was clearer. For example, if the question had been, "How many types of exception are there in Java", then "compile-time exception" is not correct. There is no such thing, especially in the sense that most people use it, where they seem to think that unchecked exceptions are "compile-time" exceptions. I understand where that thinking comes from, and there's a certain logic behind it, but it goes against the standard terminology, and it leads to confusion.


Thanks jeff, and i am not 100% sure that i never saw a statement like compile time error in SCJP6 by K&B. So, the fault is all mine.
if someone in future ask me again this same question then i will answer him, "insufficient data, next question please. "
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Personally I think that niggling over whether the errors reported by the compiler are "errors in Java" is a waste of time, even if that was where the conversation went after what you've told us so far. As the interviewer, I could ask you whether failing to document your code was an error, for example, and I wouldn't expect to be discussing whether various books described it as an "error" in so many words or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How Many types Of Errors in java ?