A while loop keeps repeating the body of the loop until:
The controlling Boolean expression becomes true
The controlling Boolean expression becomes false
It feels like it should stop
,All of the above are true sometimes
Give this one a try later!
The controlling Boolean expression becomes false
How is a constructor different from a setter (mutator) method?
They are very similar and there is no reason to have both in a program.
A constructor copies an object and a setter changes an object.
Constructors allow access to instance variables and setters let us change them.
A constructor initializes instance variables when an object is created and a setter
changes an existing object.
Give this one a try later!
A constructor initializes instance variables when an object is created and a
setter changes an existing object.
What is true about the following line of code: Dog d = new Dog(4);
It will compile and run if and only if there is a constructor in the Dog class that takes
an integer argument.
, It will compile and run if there is a constructor in the Dog class that takes a single
double as an argument (assume there is no constructor that takes an integer
argument).
It will compile and run if there are no constructors defined in the Dog class.
It will not compile and run under any circumstances
Give this one a try later!
It will compile and run if there is a constructor in the Dog class that takes a
single double as an argument (assume there is no constructor that takes an
integer argument).
How is an object different from a class?
An object is a general definition for classes. Classes are particular instantiations of
objects.
A class is a special type of object that has additional methods and variables inside.
A class is a general definition for objects. Objects are particular instances of the class
which have values for the instance variables.
An object is a special type of method that can be instantiated by using the class that
contains it.
Give this one a try later!
A class is a general definition for objects. Objects are particular instances
of the class which have values for the instance variables.
The controlling Boolean expression becomes true
The controlling Boolean expression becomes false
It feels like it should stop
,All of the above are true sometimes
Give this one a try later!
The controlling Boolean expression becomes false
How is a constructor different from a setter (mutator) method?
They are very similar and there is no reason to have both in a program.
A constructor copies an object and a setter changes an object.
Constructors allow access to instance variables and setters let us change them.
A constructor initializes instance variables when an object is created and a setter
changes an existing object.
Give this one a try later!
A constructor initializes instance variables when an object is created and a
setter changes an existing object.
What is true about the following line of code: Dog d = new Dog(4);
It will compile and run if and only if there is a constructor in the Dog class that takes
an integer argument.
, It will compile and run if there is a constructor in the Dog class that takes a single
double as an argument (assume there is no constructor that takes an integer
argument).
It will compile and run if there are no constructors defined in the Dog class.
It will not compile and run under any circumstances
Give this one a try later!
It will compile and run if there is a constructor in the Dog class that takes a
single double as an argument (assume there is no constructor that takes an
integer argument).
How is an object different from a class?
An object is a general definition for classes. Classes are particular instantiations of
objects.
A class is a special type of object that has additional methods and variables inside.
A class is a general definition for objects. Objects are particular instances of the class
which have values for the instance variables.
An object is a special type of method that can be instantiated by using the class that
contains it.
Give this one a try later!
A class is a general definition for objects. Objects are particular instances
of the class which have values for the instance variables.