package com.codegym.task.task09.task0919;
/*
Dividing by zero
*/
public class Solution {
public static void main(String[] args) {
try{
divideByZero();
}
catch(Exception e)
{
System.out.println(e.printStackTrace());
}
}
public static void divideByZero(){
int a=10;
int b=0;
System.out.println(a/b);
}
}
throwing an error.please help
Resolved
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Sindhura
9 October 2018, 05:41
Thanku
0
Sindhura
8 October 2018, 15:50
com/codegym/task/task09/task0919/Solution.java:16: error: 'void' type not allowed here
System.out.println(e.printStackTrace());
^
0
Ankush Rajput
8 October 2018, 16:35
You don't have to use println function to print stackTrace.
printStackTrace() method will take care of printing.
Simply write e.printStackTrace() without println.
+2
Khurram
8 October 2018, 06:28
what is the error you are getting
0