public class Person {
private String narne;
private String id;
public Person(String aName,
narne = aName; ^_
id = anld;
public String getName () {
return narne;
public String getld() { return id;
String anld) {
It has the same name as the class name and does not have any result type.
It initializes the object and its attributes corresponding to the class fields.