title: What could be the alternative use of readObject method in java?
body: <p>I am trying to build a simple instant messanger program. Right now I am coding for the serevr class what will run in the server side. The method I am working on at the moment is <code>whileChatting</code>.
  This method should show the string message on the chat window until the user hits <em>END</em>.
  Now, in order to read the input object in window I am using this line of code: </p>
  
  <pre><code>  message=(String)input.readObject();
  </code></pre>
  
  <p>which is showing an error that "method not found". Why is so? If there is no such method exist in java library then what can be used alternatively? I am going to paste the code for <code>whileChatting</code> method: [PLZ ask me if you need to see the code for the whole class]</p>
  
  <pre><code>      private void whileChatting(){
     String message="You are now connected";
     sendMessage(message);
     ableToType(true);
     do{
         try{
             message=(String)input.readObject();
             showMessage("\n"+message);
  
         }catch(ClassNotFoundException classNotFoundException){
             showMessage("\n the input cean't be read");
         }
  
     }while(!message.equals("CLIENT-END"));
  
    }
  </code></pre>