Get class from an object in Java
Description
The following code shows how to get class from an object.
Example
//ww w. j a v a 2 s . c om
public class Main
{
public static void main (String [] args)
{
String s = "";
Class c = s.getClass ();
System.out.println (c.getName ());
}
}
The code above generates the following result.