Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given a class called Person, as specified below. Also imagine there is a Person object called person1,created in a client class. Which of the statement
Given a class called Person, as specified below. Also imagine there is a Person object called person1,created in a client class. Which of the statement will print the values of instance variables, name and age, of person1 in the client class? Code for class Person is as follows: ublic class Person private String name; private int age; public int getAge) [ return age; ) pubic void setAgelint age)this.age- age:] public void printAge0l System.out.println("Name is:" +person1.getName)+ "age is:" +person1.getAge) ): person1.printAge0: System.out.println( getAge0 ); person1.getAge0: System.out.println(" Name is:" +name+ "age is:"age ); System.out.printin(" age is:"person1.age)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started