Class MissingResourceException in Java

digitization, transformation, binary

Class MissingResourceException in Java

This exception signals that no ResourceBundle could be located for the desired locale, or that a named resource could not be found within a given ResourceBundle.

getClassName() returns the name of the ResourceBundle class in question, and getKey() returns the name of the resource that could not be located.

Ads code goes here

In short, a MissingResourceException is thrown when a requested resource cannot be found.

The structure of the class MissingResourceException is given by

public class java.util.MissingResourceException extends java.lang.RuntimeException {
// Public Constructor
public MissingResourceException(String s, String className, String key);
// Public Instance Methods
public String getClassName();
public String getKey();
}

The details of the class structure are given as follows:

public MissingResourceException(String s, String classname, String key);

public MissingResourceException(String s, String classname, String key) constructor creates a MissingResourceException with the given information.

Parameter
s – The detail message.
classname – The resource class that generated this exception.
key – The key that was used to request a resource.

public String getClassName();

public String getClassName() method returns the class name that was used to create this exception.

This method returns the class name that generated this exception.

public String getKey();

public String getKey() method returns the key that was used to create this exception.

This method returns the key that caused this exception.
The class MissingResourceException 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()
READ  Class FileInputStream in Java

Share and Enjoy !

Leave a Comment

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