I have a basic question in java. from my research I found out that downcasting is not allowed in java because it throws an exception in runtime but in some limited cases such as Downcasting in Java
But I can't understand why this statement proceeds HttpURLConnection connection = (HttpURLConnection) url.openConnection() without problem?
(because openConnection()
returns a URLConnection
object )
be specific
I'm sorry for poor english language because i am not a native speaker