Class ParserException in Java

digitization, transformation, binary

Class ParserException in Java

ParseException exception signals that a string had an incorrect format and could not be parsed. It is typically thrown by the parse() or parseObject() methods of Format and its subclasses but is also thrown by certain methods in the java.text package that is passed patterns or other rules in string form. The getErrorOffset() method of this class returns the character position at which the parsing error occurred in the offending string.

A ParseException is thrown when the text in a string that is being parsed is not in the correct format.

Ads code goes here

public class java.text.ParseException extends java.lang.Exception{
// Public Constructor
public ParseException (String s, int erroroffset);//constructor creates a ParseException with the given detail message and offset.
// Public Instance Methods
public int getErrorOffset ();// this method returns the offset at which the parsing error occurred.
}

The class ParserException also inherits methods from class Object and Throwable.

From Object classFrom Throwable class
clone()fillInStackTrace()
getClass()getMessage()
notify()printStackTrace()
wait()printStackTrace(PrintWriter)
wait(long, int)getLocalizedMessage()
wait(long)printStackTrace(PrintStream)
equals(Object)
toString()
finalize()
hashCode()
notifyAll()

Share and Enjoy !

READ  Class IncompatibleClassChangeError in Java

Leave a Comment

Your email address will not be published. Required fields are marked *