Signature Formats

Both fields and methods have signatures within the Java class file. They are a shorthand to describe the type (of a field) and the return type and parameters (of a method). Signatures are constructed using characters or strings to represent the various data types. The signature of a field is simply the character or string representing its datatype.

The signature of a method is a pair of parentheses enclosing a list of the characters or strings representing the datatypes of the parameters, separated by semicolons. The parentheses are followed by the datatype of the return type of the method.

See Data Type Representations in Method Signatures indicates how data types are represented by characters or strings.

Data Type Representations in Method Signatures

Type

Character or String Used in Signature

long

J

byte

B

character

C

double

D

float

F

integer

I

object reference

L<classname> 1

short

S

boolean

Z

array

[<datatype>

Examples of Method Signatures

Signature

Type

Description

[C

char[]

An array of character

Ljava/lang/String

String

A Java string

[[java/lang/Object

Object[][]

A two dimensional array of objects

()V

void methodName()

A method taking no parameters and returning no value

([Ljava/lang/String;I)I

int methodName(String, int)

A method taking a String and an integer value and returning an integer.

 


1. The class name here is the full name of the class with `/'s in place of `.'s