JAVA Ch. 6 Questions with complete solutions 2023.
JAVA Ch. 6 Questions with complete solutions 2023. This is a collection of programming statements that specify the fields and methods that a particular type of object may have. a.) class b.) method c.) parameter d.) instance - correct answers.a.) class A class is analogous to a(n) ____________. a.) house b.) blueprint c.) drafting table d.) architect - correct answers.b.) blueprint An object is a(n) ___________. a.) blueprint b.) primitive data type c.) variable d.) instance of a class - correct answers.d.) instance of a class This is a class member that holds data. a.) method b.) instance c.) field d.) constructor - correct answers.c.) field This key word causes an object to be created in memory. a.) create b.) new c.) object d.) construct - correct answers.b.) new This is a method that gets a value from a class's field, but does not change it. a.) accessor b.) constructor c.) void d.) mutator - correct answers.a.) accessor This is a method that stores a value in a field of in some other way changes the value of a field. a.) accessor b.) constructor c.) void d.) mutator - correct answers.d.) mutator When the value of an item is dependent on other data, and that item is not updated when the other data is changed, what has the value become? a.) bitter b.) stale c.) asynchronous d.) moldy - correct answers.b.) stale This is a method that is automatically called when an instance of a class is created. a.) accessor b.) constructor c.) void d.) mutator - correct answers.b.) constructor When a local variable has the same name as a field, the local variable's name does this to the field's name. a.) shadows b.) complements c.) deletes d.) merges with - correct answers.a.) shadows This is automatically provided for a class if you do not write one yourself. a.) accessor method b.) default instance c.) default constructor d.) variable declaration - correct answers.c.) default constructor Two or more methods in a class may have the same name, as long as this is different. a.) their return values b.) their access specifier c.) their parameter lists d.) their memory address - correct answers.c.) their parameter lists The process of matching a method call with the correct method is known as ____________. a.) matching b.) binding c.) linking d.) connecting - correct answers.b.) binding A class's responsibilities are ____________. a.) the objects created from the class b.) things the class knows c.) actions the class performs d.) both b and c - correct answers.d.) both b and c Find the Error: public class MyClass { private int x; private double y; public void MyClass(int a, double b) { x = a; y = b; } } - correct answers.The constructor cannot have a return type, not even void. Find the error: public void total (int value1, value2, value3) { return value1 + value2 + value3; } - correct answers.The method should have int as its return type. Find the error: //creating an object Rectangle box = new Rectangle; - correct answers.The parentheses are missing. The statement should read: Rectangle box = new Rectangle(); Find the error: public class TwoValues { private int x, y; public TwoValues()
Written for
- Institution
- JAVA Ch. 6
- Course
- JAVA Ch. 6
Document information
- Uploaded on
- September 12, 2023
- Number of pages
- 4
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Also available in package deal