Home » Java programming language

Java Class class getSigners() method with example

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

Class class getSigners() method

  • getSigners() method is available in java.lang package.
  • getSigners() method is used to return the signers of this class.
  • This 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.
  • getSigners() method does not throw an exception at the time of returning signers of this class.


    public Object[] getSigners();


  • It does not accept any parameter.

Return value:

The return type of this method is Object[], it returns the following values based on the below given cases,

  • It returns the signers of this class.
  • It returns null, when no signers associated with the class.
  • It returns null when the class object denotes primitive or void type.


// Java program to demonstrate the example 
// of Object [] getSigners () 
// method of Class 

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

        // It returns the Class object represented by the String class
        // object
        Class cl = str.getClass();

        // By using getSigners() method is to get the signers of the Class
        Object[] o = cl.getSigners();
        System.out.println(cl.getName() + " " + "Signers: " + o);


java.lang.String Signers: null

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.