• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confused

 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi to all members out there. i am always confused in concept of compile error and exception. In coding i know where is wrong this code but i can not tell that it will lead to compile error or throw exception.


so please clear my this concept. Difference between compile error and exception in nutshell?
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pankaj,

Originally posted by pankaj goswami:
hi to all members out there. i am always confused in concept of compile error and exception. In coding i know where is wrong this code but i can not tell that it will lead to compile error or throw exception.

so please clear my this concept. Difference between compile error and exception in nutshell?


In a nutshell, the difference is fairly simple. A compiler error is generated if there is an error in syntax or semantics of your code (i.e. a keyword is misspelled, a missing semicolon, a missing closing parentheses or bracket).

There are two types of exceptions: checked - which is generated by the compiler, and unchecked - which isn't detected by the compiler, but thrown at runtime.

An example of a checked exception would be an Exception that is caught multiple times in a try/catch block:


An unchecked exception is generally encountered due to some uncontrollable system problem such as a network drive being down when trying to open a file on that particular drive. In this case, there is (obviously) no way for the compiler to know the network drive is unavailable.

Hope this helps...
Aloha,
Doug

-- Nothing is impossible if I'mPossible
 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic