Top 50+ Java Networking Interview Questions and Answers - 3

Question: 11

In OSI N/W Architecture, the routing is performed by which layer?

Network Layer

Question: 12

How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?

By InetAddress.getByName (“192.18.97.39”).getHostName() where 192.18.97.30 is the IP address.

Question: 13

How do I make a connection to URL?

You obtain a URL instance and then invoke openConnection on it.

URLConnection is an abstract class, which means you can’t directly create instances of it using a constructor.

We have to invoke OpenConnection method on a URL instance, to get the right kind of connection for your URL.

Related Questions