• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

confused

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic