Which of the following methods are static methods The class

Which of the following methods are static methods? The class in which the method is defined is given in parentheses following the method name. squareroot (Math) deposit (BankAccount) equals (String) play (Game from Pig example in lecture) (a) and (c) In the following familiar method invocation, what is the actual implicit parameter name? yourAccount.transfer(myAccount, amt); myAccount yourAccount amt Bankaccount this Instance data for a Java class are limited to primitive types are limited to Strings are limited to objects may be primitive types or Strings may be primitive types or objects The method example has the following signature. What is the return type? private double example(int a, String b) double int String this A private method cannot return anything

Solution

28) e) sqrt(Math) because static method can be invoked without the need for creating an instance of a class.

29) b) yourAccount

30) e) are limited to primitive types

Because the instance data are the entities that create up the class and possibly any type available whether primitive or object, and may be public or private. By using instance data of object, it allows the class to be built upon other classes. This relationship where a class has instance data of that are other classes is known as a has-a relationship

31) e) A private method cannot return anything.

 Which of the following methods are static methods? The class in which the method is defined is given in parentheses following the method name. squareroot (Math

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site