Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.

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

Sagot :

Answer:

It prints your name and age.

Explanation:

It prints the value for both name and age variables, so you need away to get it.

Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.