Level equals() method in Java with Examples Last Updated : 14 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The equals() method of java.util.logging.Level is used to check if this level object is equals to passed object or not.If both objects are equals then method will return true else false. Syntax: public boolean equals(Object ox) Parameters: This method accepts an object ox which is the reference object with which to compare. Return: This method returns true if and only if the two objects have the same level value. Below programs illustrate equals() method: Program 1: Java // Java program to illustrate equals() method import java.util.logging.Level; import java.util.logging.Logger; public class GFG { public static void main(String[] args) { // Create a Logger Logger logger = Logger.getLogger( Object.class.getName()) .getParent(); // Get level of logger Level level1 = logger.getLevel(); // Create a second Logger Logger logger2 = Logger.getLogger( String.class.getName()) .getParent(); // Get level of second logger Level level2 = logger2.getLevel(); // apply equal method boolean value = level1.equals(level2); // print level names System.out.println("Both level are equal = " + value); } } Output: Both level are equal = true Program 2: Java // Java program to illustrate equals() method import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; public class GFG { public static void main(String[] args) { // Create a Logger Logger logger = Logger.getLogger( Object.class.getName()) .getParent(); // Get level of logger Level level1 = logger.getLevel(); // Create a second Logger for ArrayList class Logger logger2 = Logger.getLogger( ArrayList.class.getName()); // Get level of second logger Level level2 = logger2.getLevel(); // apply equal method boolean value = level1.equals(level2); // print level names System.out.println("Both level are equal = " + value); } } Output: Both level are equal = false References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Level.html#equals(java.lang.Object) Comment More infoAdvertise with us Next Article Level getName() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-Level java.util.logging package Practice Tags : Java Similar Reads Level getName() method in Java with Examples The getName() method of java.util.logging.Level is used to get the non-localized string name of the Level. This method return name of this method. Syntax: public String getName() Parameters: This method accepts nothing. Return: This method returns non-localized name of this Level. Below programs ill 1 min read Level parse() method in Java with Examples The parse() method of java.util.logging.Level is used to parse a level name string into a Level. The name of the logging level must be a valid logging name. The argument string may consist of either a level name or an integer value. Level example name: "INFO", "800". Syntax: public static Level pars 2 min read List add() Method in Java with Examples The List add() method adds (appends) an element to a list. It can be used for both ArrayList and LinkedList. Example of List add() Method: Java // Java program to demonstrate // ArrayList usage import java.io.*; import java.util.ArrayList; import java.util.List; class GFG { public static void main ( 3 min read List add() Method in Java with Examples The List add() method adds (appends) an element to a list. It can be used for both ArrayList and LinkedList. Example of List add() Method: Java // Java program to demonstrate // ArrayList usage import java.io.*; import java.util.ArrayList; import java.util.List; class GFG { public static void main ( 3 min read List add() Method in Java with Examples The List add() method adds (appends) an element to a list. It can be used for both ArrayList and LinkedList. Example of List add() Method: Java // Java program to demonstrate // ArrayList usage import java.io.*; import java.util.ArrayList; import java.util.List; class GFG { public static void main ( 3 min read List clear() method in Java with Examples The clear() method of List interface in Java is used to remove all of the elements from the List container. This method does not deleted the List container, instead it just removes all of the elements from the List. Example:Java// Java Program to Demonstrate // List clear() import java.util.*; class 2 min read Like