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.

Syntax:

    public Object[] getSigners();

Parameter(s):

  • 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.

Example:

// 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);
    }
}

Output

java.lang.String Signers: null






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.