when we start the debugger in eclipse we see the following projectName.className at localhost:61744 in the debug window so could any explain the purpose or basically why does it debug on localhost
The JVM is basically started using a network port for debugging. This allows the debugger to be on a different machine, which can be very useful at times.
Now when you're debugging locally, the JVM has been started on your local machine - the localhost
IP address just refers to that, the loopback adapter for your local machine. You can attach the Eclipse debugger to a JVM running on another machine using the "Remote Java Application" debug configuration, but most of the time you'd just debug locally.
You can ignore the "localhost:" part, basically - it's just telling you which port the JVM has exposed for debugging.
See more on this question at Stackoverflow