• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to identify runtime error and compiling error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm not sure how to identify runtime error and compiling error
please give me an example of it, and tips to find out easily is
great *^__^*
Thanks
Jonathan
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jonathan,
first of all runtime error may occur due to
(1) improper main() method declaration
(2) wrong overriding case, as overridding is checked during run-time.
(3) Spl case like ClassCastException etc.
Otherwise it is a normal compile time error.
Hope that helps.
regds
NM
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
Run time errors occur during Casting between objects . all conversion is done at compile time.and further all which can be determined at compile time are compile time errors for example
CT RT
1)type =type ok ok
2)supertype =type ok ok
3)type =supertype X -
4)type =(type )Supertype ok conds i
5)type =(supertype )type ok conds ii
6)type =(type)type ok ok
7)type =type ok ok
8)type =(type)other type X ok
X= not possible
-= never arises
co-class of the object
type - the actual object
super type-parent object
conds i:
Supertype co is type OK
Supertype co is supertype X
Supertype co is someothertype X
conds ii
type's co is type OK
type co is subtype OK

HTH
sunil.s
Hope i havent confused anybody


------------------
"Winners don't do different things
They do things differently"
 
sunilkumar ssuparasmul
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually the post has disaligned actually the first "ok" is for compile time and second "ok" for runtime.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Runtime Time Exception Example
public class DefaultExceptionHandling{
public void division()
{
int num1 = 10,num2 = 0;
System.out.println(num1 + "/" + num2 + " = " + ( num1 /num2 ));
System.out.println("Returning from division");
}
public static void main(String args[]){
new DefaultExceptionHandling().division();
}
}

Compile time Exception Example
import java.io.*;
public class Baseclass{
public void method() throws IOException{}
}
class IllegalOne extends Baseclass{
public void method() throws Exception{}
}
I hope these examples will clear ur doubt
Regards
Ashish
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear sunil!
its not clear ! will you please elaborate all these ! if possible pls mail me( email: anuragpriya@usa.net ) on how to identify when a compiletime error will occur and when a runtime will occur!
regards .
anurag!

Originally posted by sunilkumar ssuparasmul:
Hai,
Run time errors occur during Casting between objects . all conversion is done at compile time.and further all which can be determined at compile time are compile time errors for example
CT RT
1)type =type ok ok
2)supertype =type ok ok
3)type =supertype X -
4)type =(type )Supertype ok conds i
5)type =(supertype )type ok conds ii
6)type =(type)type ok ok
7)type =type ok ok
8)type =(type)other type X ok
X= not possible
-= never arises
co-class of the object
type - the actual object
super type-parent object
conds i:
Supertype co is type OK
Supertype co is supertype X
Supertype co is someothertype X
conds ii
type's co is type OK
type co is subtype OK

HTH
sunil.s
Hope i havent confused anybody



reply
    Bookmark Topic Watch Topic
  • New Topic