yes, you can make a chat server/client with sockets...
server = new ServerSocket(5000, 9999);
creates a ServerSocket that listens to port 5000.
client = new Socket( InetAddress.getByName( "127.0.0.1" ), 5000 );
creates a socket that connects to your local machine's port 5000.
i'm sure you can find info and documentation on Sockets and ServerSockets at java.sun.com. it should be under the java.net section of the documentation.
i'd go into further detail, but there's really to much to write here, i'd suggest looking at the examples and docs there.
if you still need help after that, i'll post some code that i used to create a chat app.