Get the class By way of an object
public class Main { public static void main(String[] argv) throws Exception { Object object = new String(); // By way of an object Class cls = object.getClass(); } }