Java how to check the data type of variable

Java how to check the data type of variable
re‮‬fer to:lautturi.com
/**
 * @author lautturi.com
 * Java example: java check data type
 */
import java.util.*;

class Person{
	String name;
	int age;
	
	public Person(String string, int i) {
		name = string;
		age = i;
	}

	public String getName() {
		return name;
	}
}

public class Lautturi {

	public static void main(String[] args) {

		String str = "abc";
		System.out.println(str.getClass().getName());

		Person p = new Person("Lautturi",13);
		System.out.println(p.getClass().getName());
	}
}

output:

java.lang.String
hello.Person
Created Time:2017-09-19 21:16:56  Author:lautturi