Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please explain the reasons 1) Consider the following class (given as a class diagram) Person - int age -String name + Person(String, int) +Person() +

please explain the reasons image text in transcribed
1) Consider the following class (given as a class diagram) Person - int age -String name + Person(String, int) +Person() + void speak) statement is a Among the following statements, indicate which are valid and which are invalid. A valid statement that compiles and executes in any class, which has access to the Person class. If a statement is invalid, explain why. Assume that the variables p and q are of type Person and have been correctly initialized before being used. a) Person p new Person("Maryjane", 30); b) p.speak(): c) p.sleep(); d) Person p new Person; e) Person.speak(): f) Person p new Speak(): 8) p.age 25; h) System.out.println("p.name"l; o) system.out printinlp.name): j) p q; k) new Person("Huy",26).speak)

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions