Home » Java programming language

Java ClassLoader getParent() method with example

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

ClassLoader Class getParent() method

  • getParent() method is available in java.lang package.
  • getParent() method is used to return the parent class loader for delegations.
  • getParent() 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.
  • getParent() method is a final method, it does not override in child class.
  • getParent() method may throw an exception at the time of returning ClassLoader.
    SecurityException: This exception may throw when its checkPermission() method does not allow access to the parent class loader of this loader when the security manager exists.


    protected  final ClassLoader getParent();


  • It does not accept any parameter.

Return value:

The return type of this method is ClassLoader, it returns a parent class loader.


// Java program to demonstrate the example 
// of ClassLoader getParent() method of ClassLoader 

public class GetParentOfClassLoader {
 public static void main(String args[]) throws ClassNotFoundException {

  // It loads the class 
  Class cl = Class.forName("GetParentOfClassLoader");

  // It returns the class loader associated with 
  // the given class
  ClassLoader loader = cl.getClassLoader();

  // Display Loader Class
  System.out.println("Loader Class : ");


  // Display Loader Class Parent
  System.out.println("Loader Parent Class : ");


Loader Class : 
class jdk.internal.loader.ClassLoaders$AppClassLoader

Loader Parent Class : 
[email protected]

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.