When an object reference is passed to a method, the method may change the values in the object.
==true
You cannot use the fully-qualifed name of an enum constant for this.
==a case expression***
Look at the following declaration.
enum Tree { OAK, MAPLE, PINE }
What is the ordinal value of the MAPLE enum constant?
==1
If the this variable is used as a constructor call,
=A compiler error will result, if it is not the first statement of the constructor
A class's static methods do not operate on the fields that belong to any instance of the class.
==true
If you have defined a class SavingsAccount with a public static method getNumberOfAccounts(), and created a SavingsAccount object referenced by the variable account20, which of the following will call the getNumberOfAccounts()method?
==SavingsAccount.getNumberOfAccounts();
The JVM periodically performs this process to remove unreferenced objects from memory.
==garbage collection
If the following is from the method section of a UML diagram, which of the following statements is true?
+ equals(object2:Stock) : boolean
==This is a public method that accepts a FeetInches object as its argument and returns a boolean value
You may use this to compare two enum data values.
==The equals and compareTo methods that automatically come with the enum data type
Look at the following declaration.
enum Tree { OAK, MAPLE, PINE }
What is the fully-qualified name of the PINE enum constant?
==Tree.PINE
If the this variable is used as a constructor call,
==A compiler error will result if it is not the first statement of the constructor
To copy an object to another object of the same class
==Write a copy method that will make a field by field copy of the two objects
Enumerated types have this method, which returns the position of an enum constant in the declaration list.
==ordinal
If you have defined a class named SavingsAccountwith a public static data member namednumberOfAccounts, and created a SavingsAccountobject referenced by the variable account20, which of the following will assign numberOfAccounts tonumAccounts?
==numAccounts = SavingsAccount.numberOfAccounts;
When a method's return type is a class, what is actually returned to the calling program?
==A reference to an object of that class
The only limitation that static methods have is
==They cannot refer to non-static members of the class
When the this variable is used to call a constructor,
==. It must be the first statement in the constructor making the call
You can declare an enumerated data type inside of a method.
==false
The term for the relationship created by object aggregation is
==Has a
If you write a toString method to display the contents of an object, object1, for a class, Class1, then the following two statements are equivalent:
System.out.println(object1);
System.out.println(object1.toString());
~~true
You cannot use the fully-qualifed name of an enum constant for this
~~a case expression
To compare two objects
~~Write an equals method that will make a field by field comparison of the two object
What will be returned from a method, if the following is the method header:
public Rectangle getRectangle()
~~The address of an object in the class Rectangl
An instance of a class does not have to exist in order for values to be stored in a class's static fields
~~~true
If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string.
~~true
Which of the following is not true about static methods?
~~They are called from an instance of the class.
No comments:
Post a Comment