Question: please explain the reasons 1) Consider the following class (given as a class diagram) Person - int age -String name + Person(String, int) +Person() +
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
Get step-by-step solutions from verified subject matter experts
