Home » Java programming language

Java ClassLoader findLoadedClass() method with example

ClassLoader Class findLoadedClass() method: Here, we are going to learn about the findLoadedClass() method of ClassLoader Class with its syntax and example.
Submitted by Preeti Jain, on November 27, 2019

ClassLoader Class findLoadedClass() method

  • findLoadedClass() method is available in java.lang package.
  • findLoadedClass() method is used to return the Class with the given binary class name when this loader has been recorded by JVM as initializing the loader of the class with that binary name.
  • findLoadedClass() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
  • findLoadedClass() method may throw an exception at the time of loading Class object.


    protected Class findLoadedClass(String class_name);


  • String class_name – represents the binary name of the class.

Return value:

The return type of this method is Class, it returns Class object when the class has been recorded otherwise it returns null, when the class has not been recorded.


// Java program to demonstrate the example 
// of Class findLoadedClass(String class_name)
// method of ClassLoader 

class FindLoadedClass extends ClassLoader {
    void loadedClass() {
        // It checks whether the given class is loaded
        // or not by using the findLoadedClass()
        Class cl1 = super.findLoadedClass("java.lang.String");

        // If cl1 not null that means cl1 is loaded
        // then don't need to load again
        if (cl1 != null)
            System.out.println(" Class already loaded!!!");
            System.out.println("Ready to load the given class by using loadClass()!!!");

public class Main {
    public static void main(String[] args) throws Exception {
        // Creating an instance of FindLoadedClass
        FindLoadedClass lc = new FindLoadedClass();


Ready to load the given class by using loadClass()!!!

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.