Level intValue() method in Java with Examples
The intValue() method of java.util.logging.Level is used to get the integer value for this level object. Every level has an integer value associated with it. This integer value can be used for efficient ordering comparisons between Level objects. This method is helpful if we want to use the int value of a level object for comparison purposes in logging.
Syntax:
public int intValue()
Parameters: This method accepts nothing.
Return: This method returns the integer value for this level object.
Below programs illustrate intValue() method:
Program 1:
import java.util.logging.Level;
import java.util.logging.Logger;
public class GFG {
public static void main(String[] args)
{
Logger logger
= Logger.getLogger(
String. class .getName())
.getParent();
Level level
= logger.getLevel();
int val = level.intValue();
System.out.println( "intValue = "
+ val);
}
}
|
Program 2:
import java.util.logging.Level;
public class GFG {
public static void main(String[] args)
{
Level level
= Level.parse( "SEVERE" );
int value = level.intValue();
System.out.println( "intValue = "
+ value);
}
}
|
References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Level.html#intValue()
Last Updated :
14 Oct, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...