Very usefull for us in this video I learned the throws very easily iam very confusing in my institution while explaining about this. They are not explained just they said keep throws keyword now I got clarity about this thank you very much .
public void b( ){ try{ c( ); d( ); } catch( ){ } in the above case b( ) method called both methods c( ) and d( ) with try block. If c( ) throws exception means execution will jumps to catch block so d( ) will not execute right. }
package ExceptionPractise; public class Voting { public static void vote(int age) throws AgeNotFoundException { if(age>18){ System.out.println("Eligible for voting"); } else throw new AgeNotFoundException("Not elegible"); }
public static void main(String[] args) throws AgeNotFoundException{ vote(10); }//Main ends here }//class ends here
Can Someone tell what is wrong with my code public class ThrowsKeyword { public static void show () throws ClassNotFoundException( ) { Class.forName(ThrowKeyword); } public static void main(String[] args) {
try {show();} catch(ClassNotFoundException ce){ System.out.println("Class not found"); } } }
public class ThrowsKeyword { public static void show () throws ClassNotFoundException { Class.forName("ThrowKeyword"); } public static void main(String[] args) {
try { show(); } catch(ClassNotFoundException ce){ System.out.println("Class not found"); } } } just small syntax error ,every thing looks fine with u. Error->class.forname(" ") throws ClassNotFoundException (its a class not a method,dont use brackets)
best java tutorial series!
best java tutorial series! Thank you so much Navin
Very usefull for us in this video I learned the throws very easily iam very confusing in my institution while explaining about this. They are not explained just they said keep throws keyword now I got clarity about this thank you very much .
come here after wasting 1 hr in paid batch . Nice explanation 🧡💛💛
Hi Naveen, it's not thought in the series for Class.forName. Can you add a series here? It would be really helpful to us.
sir the lectures are just awesome .
sir are you from south india ? telugu states ?
yes,he has reddy in his name
public void b( ){
try{
c( );
d( );
}
catch( ){
}
in the above case b( ) method called both methods c( ) and d( ) with try block. If c( ) throws exception means execution will jumps to catch block so d( ) will not execute right.
}
It will jump to catch block to handle the exception ...then the execution will continue and d() will also be executed
@@adarshveerabathini8550 No bro, i tried d( ) will not execute
If u want the d() method to be executed u need to place it in finally block
Once an exception is raised it will directly jumps to catch block by skipping all the remaining lines so....may be it will skip d()
My main method throws AgeNotFoundException and JVM returns the error.
why this soo??
package ExceptionPractise;
public class Voting {
public static void vote(int age) throws AgeNotFoundException {
if(age>18){
System.out.println("Eligible for voting");
}
else
throw new AgeNotFoundException("Not elegible");
}
public static void main(String[] args) throws AgeNotFoundException{
vote(10);
}//Main ends here
}//class ends here
Can Someone tell what is wrong with my code
public class ThrowsKeyword {
public static void show () throws ClassNotFoundException( ) {
Class.forName(ThrowKeyword);
}
public static void main(String[] args) {
try {show();}
catch(ClassNotFoundException ce){
System.out.println("Class not found");
}
}
}
public class ThrowsKeyword {
public static void show () throws ClassNotFoundException
{
Class.forName("ThrowKeyword");
}
public static void main(String[] args) {
try {
show();
}
catch(ClassNotFoundException ce){
System.out.println("Class not found");
}
}
}
just small syntax error ,every thing looks fine with u.
Error->class.forname(" ")
throws ClassNotFoundException (its a class not a method,dont use brackets)
I remember that Class.forName was seen previously in one of the videos of this series. If anyone knows please tell me.
I don't think so he taught us this in the past.
no i guess class,forName he didnt taught us in the past videos
you have not taught static {} code up until now
In Exception you are going so fast
Yes, but you can adjust speed 😀
Accenture pdf
👍👍👍👍
but this only works for checked exceptions, what if I want to force unchecked exceptions to be handled ?
Taklusko
bro didn't hesitate