GetClass

// By way of an object
Class cls = object.getClass();

// By way of a string
try {
    cls = Class.forName("java.lang.String");
} catch (ClassNotFoundException e) {
}

// By way of .class
cls = java.lang.String.class;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.