Search code examples
javasocketsintellij-ideabigdecimal

Disconnected from the target VM, address: '127.0.0.1:51928', transport: 'socket'


What does Disconnected from the target VM, address: '127.0.0.1:51928', transport: 'socket' mean?

This is my code:

import java.math.BigDecimal;
public class puzzle2 {
    public static void main(String args[]){
        System.out.println(2.00-1.10);  //0.8999999999999999
        System.out.println(new BigDecimal("2.00").subtract(new BigDecimal("1.10")));    //0.10
    }
}

result is

Connected to the target VM, address: '127.0.0.1:51928', transport: 'socket'

0.8999999999999999

0.90

Disconnected from the target VM, address: '127.0.0.1:51928', transport: 'socket'

Solution

  • Java debugger prints the following message when it is connected to debugging port of JVM.

    Connected to the target VM, address: '127.0.0.1:51928', transport: 'socket'

    Similarly when your program terminates following message is printed to indicate that debugger has disconnected from the port.

    Disconnected from the target VM, address: '127.0.0.1:51928', transport: 'socket'

    Since these logs are written at the same time, console mixes them up.