• Post Reply Bookmark Topic Watch Topic
  • New Topic

Diff between Exception and Error  RSS feed

 
Lingam lingam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the key diff between Exception and Error?

In which situation Error will come?


Example pgm needed

Thanx in Advance

Regards,
Dharma
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Errors are thrown by the Java Virtual Machine itself when something goes truly, horribly wrong: there's no more memory, some compiled Java .class files are corrupted, inconsistent, or missing, a native method definition or native library file are missing, or there's a bug in the JVM.

Most of the time, if you catch an Error, the only thing you should do is gracefully shut down.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Lingam lingam" a.k.a. Dharma,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

We request that folks don't use obviously fictitious names. I'm thinking that "Lingam lingam" is not your real name.

Thanks Pardner! Hope to see you 'round the Ranch!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you're asking about better understanding exceptions (and errors), if you have some free time, I recommend reading
  • chapter 9 of Bruce Eckel's Thinking In Java Book
  • chapter 9 of David J. Eck's Introduction to Programming Using Java
  • chapters 80 & 81 of Bradley Kjell's Introduction to Computer Science using Java
  • Dick Baldwin's The Essence of OOP using Java, Exception Handling Article and
  • The Handling Errors with Exceptions Lesson of Sun's Java Tutorial
  • Then, when you're ready to have some fun, take a look at this past JavaRanch conversation as well as http://c2.com/cgi/wiki?IlluminateTheMainline
    [ September 28, 2004: Message edited by: Dirk Schreckmann ]
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!