Java makes programming a chat applications really easy. Look up sockets in java and thats all you will need for a very basic one. Get that far and when you encounter problems or what to do more complicated stuff with the program (like maybe a secure RSA encryption) chat program let me know and i'll be able to lend a hand.
Basically it's like he said: look up sockets. The PrintWriter will probably be used, but you have your options open for choosing a Class that will read and write data. Split functionality up as much as you can when writing out the classes. And that's about all I have right now. Get a little done and we can help you more as he said.
If you think Java is complicated, try some entry level tutorials first before diving into creating multithreaded networked applications.
Sun has some great tutorials, and O'Reilly has their excellent "Head First Java" book to get you up and running.
Java can be intimidating at first but i agree with jwenting that you should get some entry level tutorials. The official sun tutorials are extremely good and you also yahoo for them.
If you were building a chat program i would suggest that you used a java application rather than an applet as it has lesser restrictions. Also try learning about basic networking i.e sockets.
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...