XAMPP is mostly a package of software mainly Apache webserver, MySQL, Perl and PHP. Since you want to code in java, the chat server would be based on Socket Programming.
As per the code snippet you have posted is a simple java server, which can listen to request and print on screen what's been send to it.
On doing some google search found a simple step by step explanation of creating chat application in java.
http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html