Q:

Retrieving array class name

I have I problem.
In a method I receive a general Object as parameter and I have to retrieve the name of the class
public void myMethod(Object o)
  String className = o.getClass().getName();
  ...
}

It works, except when i give to the methods arrays.
For example if a pass to the method an array of double (double[]), getClass().getName() returns me [D
How can I retrieve something like double[]?

A:

[D means an array of doubles. Check this link for an explanation on class names. Why would you like something like double[] instead?

A:

Simple name of the class is what you are looking for:
System.out.print(new String[0].getClass().getSimpleName());

and the result well be:
String[]

