Question: please kindly help answer this Java questions! God bless! Thanks What will be returned from a method, if the following is the method header? public
please kindly help answer this Java questions! God bless! Thanks
What will be returned from a method, if the following is the method header? public Rectangle getRectangle() a An object of the class Rectangle b The address of an object of the class Rectangle c The values stored in the data members of the Rectangle object the method changed d A graph of a rectangle If you have defined a class SavingsAccount with a public static method getNumberOfAccounts(), and created a SavingsAccount object referenced by the variable account 20, which of the following will call the getNumberOfAccounts()method? a getNumberOfAccounts(); b Savings Account getNumberOfAccounts(); c getNumberOfAccounts (account20); d None of the above, you cannot call a static method. If object1 and object2 are objects of the same class, to make object2 a copy of object1: a assign object1 to object2, such as object2 = object 1; b write a copy method that will make a field by field copy of object1 data members into object2 data members c use the Java copy method that is a part of the Java language d use the default constructor to create object2 with object1 data members When a method's return type is a class, what is actually returned to the calling program? a An object of that class b A reference to an object of that class c Only the values in the object that the method accessed d Nothing, the return type is strictly for documentation in this situation Which of the following is not true about static methods? a It is not necessary for an instance of the class to be created to execute the method. b They are created by placing the key word static after the access specifier in the method header. c They are called from an instance of the class. d They are often used to create utility classes that perform operations on data, but have no need to collect and store data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
