How do I make a connection to URL?
Submitted by: AdministratorYou 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. Eg. URL url;
URLConnection connection;
try {
url = new URL(”…”);
connection = url.openConnection();
} catch (MalFormedURLException e) { }
Submitted by: Administrator
URLConnection connection;
try {
url = new URL(”…”);
connection = url.openConnection();
} catch (MalFormedURLException e) { }
Submitted by: Administrator
Read Online Java Networking - Sockets and RMI Job Interview Questions And Answers
Top Java Networking - Sockets and RMI Questions
☺ | What does RMI stand for? |
☺ | What is the difference between the File and RandomAccessFile classes? |
☺ | What information is needed to create a TCP Socket? |
☺ | When MalformedURLException and UnknownHostException throws? |
☺ | How do I make a connection to URL? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |