Java Socket isClosed () method

The isClosed () method of Java Socket class returns the closed state of the socket.

Syntax

Parameter

NA

Return

The isClosed () method would return a Boolean value 'true' if the socket has been closed successfully.

Example 1

Test it Now

Output:

The socket is closed: true

Example 2

Test it Now

Output:

The socket is closed: false




Latest Courses