java.net.PortUnreachableException
Signals that an ICMP Port Unreachable message has been received on a connected datagram.
Declaration
public class PortUnreachableException extends SocketException {@java.io.Serialprivate static final long serialVersionUID = 8462541992376507323L;public PortUnreachableException(String msg) {super(msg);}public PortUnreachableException() {}}
Methods
1. PortUnreachableException()
java.net.PortUnreachableException.PortUnreachableException()
Construct a new PortUnreachableException with no detailed message.
Java
package com.PortUnreachableException;import java.net.PortUnreachableException;public class PortUnreachableException1 {public static void main(String[] args) {PortUnreachableException exception =new PortUnreachableException();System.out.println(exception);}}
Output:
java.net.PortUnreachableException
2. PortUnreachableException(String msg)
java.net.PortUnreachableException.PortUnreachableException(String msg)
Constructs a new PortUnreachableException with a detailed message.
Parameters: One parameter is required for this method.
msg: the detailed message
Java
package com.PortUnreachableException;import java.net.PortUnreachableException;public class PortUnreachableException2 {public static void main(String[] args) {String msg = "message";PortUnreachableException exception =new PortUnreachableException(msg);System.out.println(exception);}}
Output:
java.net.PortUnreachableException: message
No comments:
Post a Comment