Question

A class can have multiple constructors and each constructor must accept a unique set of parameters. True False
If the superclass has more than 2 constructors that requires parameters, then the subclasses can inherit these constructors a
An inner class can reference the data and methods defined in the outer class in which it nests, so you do not need to pass th

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) A Class can have multiple constructors and each constructor must accept a unique set of parameters

TRUE

because when we compile dynamically it gives us a error called ambiguity error but on error doesnot occur when we compile in static.so, a class can have multiple constructors and each constructor must accept a unique set of parameters.

2) if a sub class has more than 2 constructors that requires parameters,then the sub class can inherit these constructors automatically and we do not need to write any constructors in the sub class

FALSE

because constructors cannot be inherited through subclass for that we need to create specified objects .so a sub class cannot inherit the constructors automatically.

3) An inner class can reference the data and methods defined in the outer class in which it nests,so you do not need to pass the reference of the outer class to the constructor of the inner class

TRUE

because if we created a nested class we can acces the constructor methods of outer class by using call by reference form the inner class .so in this there is no need to pass the reference of the outer class to the constructof the inner class

Add a comment
Know the answer?
Add Answer to:
A class can have multiple constructors and each constructor must accept a unique set of parameters....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create an abstract class “Appointment” that represents an event on a calendar. The “Appointment” class will...

    Create an abstract class “Appointment” that represents an event on a calendar. The “Appointment” class will have four instance variables: • An instance variable called “year” which will be of type int • An instance variable called “month” which will be of type int • An instance variable called “day” which will be of type int • An instance variable called “description” which will be of type String The “Appointment” class must also implement the following methods: • A getter...

  • int [][] myarray; Above statement declares an array, but does not create the array object

    int [][] myarray; Above statement declares an array, but does not create the array object. True FalseYou can adjust the number of elementi in an array after it has been created. True FalseA class can have multiple constructors and each constructor must accept a unique set of parameters. True False

  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • Question 1 1 pts Which of the following is not a valid class name in Java?...

    Question 1 1 pts Which of the following is not a valid class name in Java? O MyClass MyClass1 My_Class MyClass# Question 2 1 pts Which of the following statements is False about instance variables and methods? Instance variables are usually defined with private access modifier. Instance variables are defined inside instance methods. Instance methods are invoked on an object of the class that contains the methods. A class can have more than one instance variables and methods. Question 3...

  • C++ program to implement inheritance with following requirements, Classes :- Animal.cpp, bird.cpp, canine.cpp, main.cpp (to test...

    C++ program to implement inheritance with following requirements, Classes :- Animal.cpp, bird.cpp, canine.cpp, main.cpp (to test it) :- -You may need getters and setters also. 1. Declare and define an animal base class: animal stores an age (int), a unique long ID (a boolean that is true if it is alive, and a location (a pair of double). animal requires a default constructor and a 3 parameter constructor. Both constructors should set the unique ID automatically. They should also set...

  • Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance...

    Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance and interface behaviors . The link to the PDF of the diagram is below MotorVehical.pdf Minimize File Preview User Define Object Assignment: Create a Intellij Project. The Intellij project will contain three user defined classes. The project will test two of the User Define Classes by using the invoking each of their methods and printing the results. You are required to create three UML...

  • Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters...

    Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters long encryptedPassword : String key int Must be between 1 and 10(inclusive) accountId - A unique integer that identifies each account nextIDNum – a static int that starts at 1000 and is used to generate the accountID no other instance variables needed. Default constructor – set all instance variables to a default value. Parameterized constructor Takes in clearPassword, key. Calls encrypt method to create...

  • Need help creating a Java program with mandatory requirements! VERY IMPORTANT: The George account class instance...

    Need help creating a Java program with mandatory requirements! VERY IMPORTANT: The George account class instance must be in the main class, and the requirement of printing a list of transactions for only the ids used when the program runs(Detailed in the Additional simulation requirements) is extremely important! Thank you so very much! Instructions: This homework models after a banking situation with ATM machine. You are required to create three classes, Account, Transaction, and the main class (with the main...

  • Create a linked list with given code Given code: import java.util.Iterator; public interface Set { /**...

    Create a linked list with given code Given code: import java.util.Iterator; public interface Set { /** Removes all of the elements from this set */ void clear(); /** Returns true if this set contains no elements @return true if this set contains no elements */ boolean isEmpty(); /** Returns the number of elements in this set (its cardinality) @return the number of elements in this set */ int size(); /** Returns an iterator over the elements in this set @return...

  • Y. Daniel Liang’s 8 Class Design Guidelines were posted on the File Manager and handed out...

    Y. Daniel Liang’s 8 Class Design Guidelines were posted on the File Manager and handed out in class. Please choose 5 guidelines and discuss them in depth. For each guideline, use 1 page or more for your discussion. You can use the code provided in class to demonstrate your points. The code should not be more than one-third of your writing. 1. Cohesion • [✓] A class should describe a single entity, and all the class operations should logically fit...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT