Consider the following code segment and classes. Student tom = new Student(); System.out.println(tom); public class Person {
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider the following code segment and classes.
Student tom = new Student(); System.out.println(tom);
public class Person { private int age; private int grade; private String gender; public Person() { age = 16; grade = 10; gender = "Female"; }
public String toString() { String temp = "[" + age + ", " + grade + ", " + gender + "]"; return temp; } } public class Student extends Person { }
What is printed as a result of executing the code segment?
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date: