English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

package javaexception;
class App {
public static void main(String args[]) {
a();
}
static void a() {
b();
}
static void b() {
c();
}
static void c() {
d();
}
static void d() {
int i = 1;
int j = 0;
System.out.println(i / j);
}
}
is my program...
java.lang.ArithmeticException: / by zero

at javaexception.App.d(App.java:36)

at javaexception.App.c(App.java:29)

at javaexception.App.b(App.java:24)

at javaexception.App.a(App.java:18)

at javaexception.App.main(App.java:13)
is the exception error...
what is my doubt is ..
App is my program name,,
(App.java:29)

(App.java:24)

(App.java:18)

(App.java:13)
what does the numbers 18,13 etc means

2006-07-17 20:26:44 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

may be the line numbers of your coding

2006-07-17 21:55:35 · answer #1 · answered by kanna 3 · 1 2

Firstly, I hope you understand the error was given because you are dividing a number, 1 in this case, by 0. This will always an exception.

Secondly, the numbers that are given out is a dump of the stack.

The stack basically holds the path that was taken to get to the exception, then when the exception happens, it produces what is called a stack trace.

You can trace the exception back through this stack to find out where the exception was called from in your program, etc. I hope that did not confuse you.

Basically, you stack trace reads as such,

The exception called ArithmeticException is thrown at line 36 of your App program.

Line 29 called the method the method that threw the exception, I presume it is the line the says 'd();'

Line 24 called the 'c' method, 'c();'.

Line 18 called the 'b' method, 'b();'.

Line 13 called the 'a' method, 'a();'.


Therefore, you can see the program worked correctly,

main called a, a called b, b called c, c called d, d threw the exception.

2006-07-20 11:04:35 · answer #2 · answered by Mark aka jack573 7 · 0 0

It means exception raised at 29 (i/j)... here u r not handling exceptions so its thrown to its caller functiion (c())... 24 is line no of d(); in c() function.
like 18 and 13 are c(); and b();.........

2006-07-17 22:14:41 · answer #3 · answered by vijji_bdr 2 · 1 0

siscuss @ http://www.studyjava.org

2006-07-21 17:49:32 · answer #4 · answered by ihoston 3 · 0 0

fedest.com, questions and answers