Explore Westonci.ca, the top Q&A platform where your questions are answered by professionals and enthusiasts alike. Explore our Q&A platform to find reliable answers from a wide range of experts in different fields. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

Can someone help me with this code please explain it to me in simple way
it's anstance variable in jave public class Record{

public String name;// this instance variable is visible for any child class.

private int age;// this instance age variable is visible in Record class only.

public Record (String RecName)
{
name = RecName;
}

public void setAge(int RecSal)
{
age = RecSal;
}

public void printRec()
{
System.out.println("name : " + name ); // print the value for “name”
System.out.println("age :" + age); //prints the value for “age”
}
public static void main(String args[])
{
Record r = new Record("Ram");
r.setAge(23);
r.printRec();
}
}
Output:

name : Ram
age :23