get class name code example

Example 1: php get class name of this

get_class($this);

Example 2: javascript get class name

document.getElementById("myDIV").className = "mystyle";

Example 3: get name of class javascript

myObj.constructor.name

Example 4: how get class name

String className = this.getClass().getSimpleName();

Example 5: java class name to string

String className = n.getClass().getName();
String name = className.substring(className.lastIndexOf('$')+1,className.length()-4);
System.out.println(name);

Example 6: getting class name in java

a.getClass().getName();