public class Test { { System.out.println(10/0); } public static void main(String[] args) { System.out.println("Hi"); } } Could you please clarify why this program did not throw any default exception?
jvm takes only main method but in this scenario you took {System.out.println(10/0);} outside of main method as such not provide Arithmetic Exception ......
Hi Rakhi You wrote "10/0" in sysout that too in instance intializer block so, that part is not going to get executed as in the same class main method is present and JVM calls that main method directly without any instance of the class. Even if you are removing 10/0 and try to print anything, it will not get printed. I hope, it is clear! th-cam.com/video/fYPrkIurLJY/w-d-xo.html
Sir explanation is unbelievable ❤️ and very useful sir
Really helpful :) Thank you so much, Durga Sir!
Yes sir
Nice explanation
Way of teaching very nice sir thanku u so much sir😄
5:55 errors topic begins
throws it's supermost of a parent class in Java
God bless you❤
thank you sir!!🙌
sir, is syntax error, is error or exception?
as it is caused by our program and can be recoverable.
Hello Rushikesh.
Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28
Every syntax error is an exception.
Thank you sir
public class Test {
{
System.out.println(10/0);
}
public static void main(String[] args) {
System.out.println("Hi");
}
}
Could you please clarify why this program did not throw any default exception?
Sir, tell me solution for that pls
jvm takes only main method but in this scenario you took {System.out.println(10/0);} outside of main method as such not provide Arithmetic Exception ......
Thank you
Rakhi Sharma welcome to programming world
Hi Rakhi
You wrote "10/0" in sysout that too in instance intializer block so, that part is not going to get executed as in the same class main method is present and JVM calls that main method directly without any instance of the class. Even if you are removing 10/0 and try to print anything, it will not get printed. I hope, it is clear!
th-cam.com/video/fYPrkIurLJY/w-d-xo.html