Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the definition of the Person class below. The class uses the instance variable adult to indicate whether a person is an adult or not.

Consider the definition of the Person class below. The class uses the instance variable adult to indicate whether a person is an adult or not.
public class Person
{
private String name;
private int age;
private boolean adult;
public Person (String n, int a)
{
name = n;
age = a;
if (age >=18){
adult = true;
}
else {
adult = false;
}
}
}
How would you create an object in a client class for an adult person?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

A. 316.00 B. 519.69 c. 326.60 D. 33.63

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago