Updated chat.java

removed mainmethod and created a constructor instead