java.net.ProtocolException
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
Declaration
public class ProtocolException extends IOException {@java.io.Serialprivate static final long serialVersionUID = -6098449442062388080L;public ProtocolException(String message) {super(message);}public ProtocolException() {}}
Methods
1. ProtocolException()
java.net.ProtocolException.ProtocolException()
Constructs a new ProtocolException with no detailed message.
Java
package com.ProtocolException;import java.net.ProtocolException;public class ProtocolException1 {public static void main(String[] args) {ProtocolException protocolException =new ProtocolException();System.out.println(protocolException);}}
Output:
java.net.ProtocolException
2. ProtocolException(String message)
java.net.ProtocolException.ProtocolException(String message)
Constructs a new ProtocolException with the specified detail message.
Parameters: One parameter is required for this method.
message: the detailed message.
Java
package com.ProtocolException;import java.net.ProtocolException;public class ProtocolException2 {public static void main(String[] args) {String message = "error occured";ProtocolException protocolException =new ProtocolException(message);System.out.println(protocolException);}}
Output:
java.net.ProtocolException: error occured
No comments:
Post a Comment