java check whether property exists in class

java check whether property exists in class
refer t‮‬o:lautturi.com
/**
 * @author lautturi.com
 * Java example: java check if there is public property in class
 */
import java.util.*;
class Person{
	public String name;
	public int age;
}

public class Lautturi {
	
	public static void main(String[] args) {
	 
		Person p = new Person();
		if( Arrays.stream(p.getClass().getFields())
	            .anyMatch(f -> f.getName().equals("name")))
			System.out.println("The Person class has a field named name ");
		
	}
}

output:

The Person class has a field named name
Created Time:2017-09-19 22:01:40  Author:lautturi