definition

is a built-in class, which you can use when you want some information about your class

Information like:

Check what information you can get more on the oracle page. You can find all the methods there.

Code

How to get this information in code?

  1. Create an object of your class
  2. create a class object, your class object contains all the information about your class
package Print;

public class ClassVariable {
	
	void start() {
		ClassVariable newObject = new ClassVariable();
		Class newClassObject = newObject.getClass();
	}

	public static void main(String[] args) {
		new ClassVariable().start();

	}

}

 

3. asking for information looks like this:java get simple name

*In this example you will get back the name of the class