• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Runtime and compile time errors

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

While solving mock exam I sometimes get confused with the runtime errors and compile time errors.It difficult to choose either one from all options given.Can anyone tell how to explicitly differentiate between these two while solving the questions. Also are there any tips and tricks with question solving which can help?
 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two kind of errors in java
1) Runtime error (aka unchecked error)
2) Compile time errors (aka checked error)

When there is a error at compile time these type of error is called Compile time error(wrong in java compiler perspective).
Eg-> double d = �Error 1�;
int s = �100.013�;

When error occur at run time these type of error is called runtime error. These error won�t be caught at compile time.

Double d = 1000/0;
 
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think "Double d = 1000/0;" gives you Infinity
"Integer"/0 throws ArithemticException
 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Checked exception are those which the Java compiler forces you to catch. e.g. IOException are checked Exceptions

Runtime exceptions are those exceptions that are thrown at runtime because of either wrong input data or because of wrong business logic etc.
If you invoke start() on dead thread instance, you will get runtime (not compiler) exception.
These are not checked by the compiler at compile time.
[ July 19, 2007: Message edited by: Aaron Raja ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic