Java Network
Home Up Core java Core Java 2 Everything Else Core Java 3 Java Network Unanswered Questions

 

Java Interview Questions

Visit Java Interview Homepage

Java is a great language for network programming. IT includes UDP and TCP socket API that is arguably simpler then C/C++/PERL Socket API in Windows (Winsock) or Unix (Berklay Socket API). On the other hand it provides RMI API that could be used for higher level implementations. With RMI network operations look like method calls.

Java also had API for handling Http / SMTP (email) / FTP and CORBA. Many third party APIs are also available for accessing other network services. Apache foundation has released Http client for Java, that can replace Built in Http API in Java and supports cookies, redirects, http 1.1 and many more features.

  • What two protocols are used in Java RMI technology?

    Java Object Serialization and HTTP. The Object Serialization protocol is used to marshal call and return data. The HTTP protocol is used to "POST" a remote method invocation and obtain return data when circumstances warrant.

     

  • What is difference between Swing and JSF?

    The key difference is that JSF runs on the server in a standard Java servlet container like Tomcat or WebLogic and generates html output that is viewed on Web browsers (This client). Swing is used for creating Thick clients.

     

  • What is JSF?

    JSF stands for Java Server Faces, or simply Faces. It is a framework for building Web-based user interfaces in Java. Like Swing, it provides a set of standard widgets such as buttons, hyperlinks, checkboxes, and so on.

     

  • What is the difference between URL instance and URLConnection instance?

    A URL instance represents the location of a resource, and a URLConnection instance represents a link for accessing or communicating with the resource at the location.

     

  • 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. Eg. URL url;

    URLConnection connection;
        try{ url = new URL("...");
            connection = url.openConnection();
        }catch (MalFormedURLException e) { }
    
  • What Is a Socket?

    A socket is one end-point of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent. Socket classes are used to represent the connection between a client program and a server program. The java.net package provides two classes--Socket and ServerSocket--which implement the client side of the connection and the server side of the connection, respectively.

     

  • What information is needed to create a TCP Socket?

    The Local System?s IP Address and Port Number. And the Remote System's IPAddress and Port Number.

     

  • What are the two important TCP Socket classes?

    Socket and ServerSocket. ServerSocket is used for normal two-way socket communication. Socket class allows us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.

     

  • When MalformedURLException and UnknownHostException throws?

    When the specified URL is not connected then the URL throw MalformedURLException and If InetAddress? methods getByName and getLocalHost are unable to resolve the host name they throw an UnknownHostException.

     

  • What does RMI stand for?
    It stands for Remote Method Invocation.

     

  • What is RMI?
    RMI is a set of APIs that allows to build distributed applications. RMI uses interfaces to define remote objects to turn local method invocations into remote method invocations.
  • Search this site for:

     

    Please use this form to communicate any issues/problems with this website or its contents. If you find any content inappropriate for any reason, please let me know. Hit Counter