java programming

Anusha

Member
Jun 13, 2006
25,864
5
0
Exceptions are mostly runtime errors.
Eg: You can convert String str = "55" to int by using

int x = Integer.parseInt(str);

but if str = "a", you can't convert it to an integer. Then it will give an exception called NumberFormatException

:)
 

kamali

Member
Nov 24, 2006
147
0
0
Anusha said:
Exceptions are mostly runtime errors.
Eg: You can convert String str = "55" to int by using

int x = Integer.parseInt(str);

but if str = "a", you can't convert it to an integer. Then it will give an exception called NumberFormatException

:)

Thanx :) :yes: :yes: :yes: :yes:
 

sri_lion

Member
Sep 14, 2006
12,908
102
0
Kuala Lumpur
kamali said:
What is java exception ? please give me a simple example.

:yes: :cool: :cool:

Exceptions are situations that's normally occurs when executing certain logics that are not normal or typical.

For example:

In Programming any number divided by 0 would be infinity,
(if you are familliar with C programming you would recall that if you try dividing numbers by 0 the program runs forever! else you can try this in your windows calculator where it will give you a "cannot calculate" message)

but in Java it doesn't happen.. instead it recognize the situation and "catch it" these kind of situations are called an exceptions!! And that "catching" is called Exception Handling!!
 

kamali

Member
Nov 24, 2006
147
0
0
sri_lion said:
Exceptions are situations that's normally occurs when executing certain logics that are not normal or typical.

For example:

In Programming any number divided by 0 would be infinity,
(if you are familliar with C programming you would recall that if you try dividing numbers by 0 the program runs forever! else you can try this in your windows calculator where it will give you a "cannot calculate" message)

but in Java it doesn't happen.. instead it recognize the situation and "catch it" these kind of situations are called an exceptions!! And that "catching" is called Exception Handling!!

Wow ur a good teacher. I got a clear picture about exception. :yes: :lol: :lol:
Thank u very much.