Assume the class BankAccount has been created, and also the complying with statement correctly creates an instance of the class:
BankAccount account = new BankAccount(5000.0);
What is TRUE about the following statement?
System.out.println(account);
The account object’s toString an approach will it is in implicitly called.
You are watching: A static field is created by placing:
A compiler error will occur.
The method will screen unreadable binary data on the screen.
A runtime error will occur.
The account object’s toString method will be implicitly called.
To compare two objects in a class:
due to the fact that objects consist of of number of fields, you cannot to compare them
write a technique to execute a byte-by-byte to compare of the two objects
create an equals method that will make a field by ar compare of the 2 objects
usage the == operator, e.g. Object1 == object2
write an equals technique that will make a ar by ar compare the the two objects
Java instantly stores this value in all uninitialized revolution member variables:
null
0
-1
false
0
An object’s ________ is simply the data the is save in the object’s areas at any kind of given moment.
value
assessment
record
state
state
Which the the following is not true around static methods?
castle are produced by place the vital word static after the accessibility specifier in the method header.
They space called straight from the class.
lock are regularly used to produce utility class that do operations top top data, but have no should collect and also store data.
that is vital for an circumstances of the class to be created to execute the method.
It is crucial for an instance of the course to be produced to execute the method.
What will be went back from a method, if the complying with is the an approach header?
publicly Rectangle getRectangle()
an item of the class Rectangle
The values stored in the data members that the Rectangle thing the technique changed
A graph that a rectangle
The resolve of things of the course Rectangle
The deal with of things of the class Rectangle
A deep copy of one object:
is always a personal method
is a bogus term, it has actually no meaning
is an assignment of that object to an additional object
is an procedure that copies an aggregate object, and all the objects the references
is an procedure that duplicates an aggregate object, and all the objects it references
If friend have characterized a class named SavingsAccount v a public revolution data member called numberOfAccounts, and created a SavingsAccount thing referenced by the variable account20, which of the adhering to will assign numberOfAccounts come numAccounts?
numAccounts = account20.numAccounts;
numAccounts = numberOfAccounts;
numAccounts = SavingsAccount.numberOfAccounts;
none of these, you cannot referral a static data member.
numAccounts = SavingsAccount.numberOfAccounts;
The JVM regular performs this process to eliminate unreferenced objects indigenous memory.
memory sweeping
device restore
storage shuffling
rubbish collection
garbage collection
A static field is produced by placing:
the crucial word static after the field name
the key word revolution after the accessibility specifier and before the field’s data type
the an essential word static after the access specifier and also field’s data type
the in a static field block
the vital word revolution after the access specifier and also before the field’s data type
When a method’s return kind is a class, what is actually returned to the calling program?
things of the class
A recommendation to an object of that class
just the values in the object the the an approach accessed
Nothing, the return form is strictly because that documentation in this situation.
A referral to an object of the class
If object1 and also object2 space objects of the very same class, to make object2 a copy that object1:
usage the Java copy method that is a part of the Java language
entrust object1 come object2, such as object2 = object1;
use the default constructor to produce object2 v object1 data members
compose a copy technique that will make a field by ar copy of object1 data members into object2 data members
write a copy method that will certainly make a ar by field copy the object1 data members into object2 data members
Look in ~ the complying with declaration:
enum Tree OAK, MAPLE, pine tree
What is the ordinal value of the MAPLE enum constant?
0
1
2
3
Tree.MAPLE
1
You cannot usage the fully-qualified name of one enum constant for this.
a switch expression
an argument to a method
a case expression
every one of these
a case expression
Assuming the following declaration exists:
enum Tree OAK, MAPLE, jaw
What will the following code display?
System.out.println(Tree.OAK);
Tree.OAK
0
1
OAK
Nothing. This explain will cause an error.
OAK
Which the the following is no true around static methods?
they are produced by put the an essential word revolution after the access specifier in the method header.
castle are called from an circumstances of the class.
they are frequently used to create utility class that do operations on data, yet have no must collect and store data.
it is not necessary for an circumstances of the course to be created to execute the method.
They are referred to as from an circumstances of the class.
See more: Last N I Dreamed Of You Last Night, I Had A Dream About You And Me…
A declaration because that an enumerated type begins v this key word.
enum
enum_type
enumerated
ENUM
enum
The term because that the relationship created by thing aggregation is:
is a
Sub-class object
has a
inside class
has a
You cannot usage the == operator to compare the materials of:
objects
strings
Boolean values
integers
objects
The name of the enum constants in an enumerated data form must be enclosed in quotation marks. True False
False
If you compose a toString technique for a class, Java will immediately call the technique any time friend concatenate an item of the class with a string. True False
True
Both instance fields and also instance approaches are linked with a specific instance the a class, and also they can not be supplied until an instance of the course is created. True False
True
The this crucial word is the surname of a referral variable that is easily accessible to all revolution methods. True False
False
A single copy that a class’s static field is shared by all instances of the class. True False
True
If a course has a an approach named finalize, the is called immediately just prior to a data member that has actually been determined as final of the course is damaged by the rubbish collector. True False
False
The key word this is the surname of a referral variable that things can use to describe itself. True False
False
An instance of a course does not have to exist in order for worths to it is in stored in a class’s static fields. True False