Class isLocalClass() method in Java with Examples Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The isLocalClass() method of java.lang.Class class is used to check if this Class is the Local class. The method returns true if this Class is the Local class. It returns false otherwise.Syntax: public boolean isLocalClass() Parameter: This method does not accept any parameter.Return Value: This method returns true if this Class is the Local class. It returns false otherwise.Below programs demonstrate the isLocalClass() method.Example 1: Java // Java program to demonstrate isLocalClass() method public class Test { public static void main(String[] args) throws ClassNotFoundException { // returns the Class object for this class Class myClass = Class.forName("Test"); System.out.println("Class represented by myClass: " + myClass.toString()); // Check if this class is an localClass // using isLocalClass() method System.out.println("Is Test an localClass: " + myClass.isLocalClass()); } } Output: Class represented by myClass: class Test Is Test an localClass: false Example 2: Java // Java program to demonstrate isLocalClass() method public class Test { public static void main(String[] args) throws ClassNotFoundException { class A { } // returns the Class object for A Class myClass = A.class; // Check if myClass is an localClass // using isLocalClass() method System.out.println("Is A an localClass: " + myClass.isLocalClass()); } } Output: Is A an localClass: true Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#isLocalClass-- Comment More infoAdvertise with us Next Article Class isInstance() method in Java with Examples S srinam Follow Improve Article Tags : Java Java-lang package Java-Functions Java.lang.Class Practice Tags : Java Similar Reads Class isInstance() method in Java with Examples The isInstance() method of java.lang.Class class is used to check if the specified object is compatible to be assigned to the instance of this Class. The method returns true if the specified object is non-null and can be cast to the instance of this Class. It returns false otherwise. Syntax: public 2 min read Class getEnclosingClass() method in Java with Examples The getEnclosingClass() method of java.lang.Class class is used to get the enclosing class of this class. The method returns the enclosing class of this class, if this class is a local class or anonymous class declared in that class. Else this method returns null.Syntax: public Class getEnclosingCla 2 min read Class getClasses() method in Java with Examples The getClasses() method of java.lang.Class class is used to get the classes of this class, which are the class and interfaces that are public and its members. The method returns the classes of this class in the form of array of Class objects. Syntax: public Class[] getClasses() Parameter: This metho 2 min read Class getSuperclass() method in Java with Examples The getSuperclass() method of java.lang.Class class is used to get the super class of this entity. This entity can be a class, an array, an interface, etc. The method returns the super class of this entity.Syntax: public Class<T> getSuperclass() Parameter: This method does not accept any param 2 min read Class forName() method in Java with Examples The forName() method of java.lang.Class class is used to get the instance of this Class with the specified class name. This class name is specified as the string parameter.Syntax: public static Class<T> forName(String className) throws ClassNotFoundException Parameter: This method accepts the 1 min read Class getDeclaringClass() method in Java with Examples The getDeclaringClass() method of java.lang.Class class is used to get the declaring class of this class. The method returns the declaring class of this class, if this class or interface is a member of another class. Else this method returns null. Syntax: public Constructor getDeclaringClass() Param 2 min read Like