How does java detects Checked Exceptions? -


if write things :

public static void main(string[] args) {     try {     } catch (malformedurlexception e) {          e.printstacktrace()     }; } 

java compiler shows compilation error @ catch clause of malformedurlexception. if insert line url url = new url("hi"); in try block , complaining stops. thought java must binding these checked exceptions package. tried class of java.net package inserting " cookiemanager manager = new cookiemanager(); " in try block. compilation error again starts.

so how jvm bind these checked exceptions java classes compilation time errors this?

a method declaration specifies exceptions method throws. information accessible compiler. compiler emits error message if attempt catch exception cannot thrown code invoked in try clause.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -