You design a java with multiple same-name constructors - how java resolves the s
ID: 3583323 • Letter: Y
Question
You design a java with multiple same-name constructors - how java resolves the situation when accessing one of the constructors? Explain briefly. what is the name of the method feature that allows java to overcome the name conflict? You design a java class with multiple same-name method - how java resolves the situation when accessing one of the constructors? what is the name of the method feature that allows java to overcome the name conflict? You design a java class with private instance variable - Can a main method which instantiates the class modifies the value of those private variables directly? Can the main method get the values of these private variables directly? Through what kind of method that an instantiated main change the values of those private variables? Through what kind of method that an instantiated main read the values of those private variables?Explanation / Answer
Ans22(1) In constructor overloading there can be multiple same name constructor but with different parameters. So, java resolves it based on parameters.
Ans22(2) Method overriding is used to resolve conflicting methods
Ans23(1) Methods are differentiated based on the number of parameters and type of parameters.
Ans23(2) The action is called method Overloading
Ans24(1) No
Ans24(2) No
Ans24(3) If the Main and Class are in the same package then Public and default methods are used else only Public is used.
Ans24(4) If the Main and Class are in the same package then Public and default methods are used else only Public is used.(same as of above question)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.