Question: QUESTION 1 Are those two class attribute / field declarations absolutely equivalent in Java? 1) double taxRate; 2) public double taxRate; Yes or no? QUESTION

QUESTION 1

Are those two class attribute / field declarations absolutely equivalent in Java?

1) double taxRate;

2) public double taxRate;

Yes or no?

QUESTION 2

All objects used by your program are instantiated at the same time and the moment your program starts. True or false?

True

False

QUESTION 3

Each of instance of a class will have its own set of instance (non-static) attributes / fields. True or false?

True

False

QUESTION 4

How can you provide information hiding in a class?

By "hiding" an attribute inside a method.

By making data static.

By using an appropriate access modifier.

Only by using a constructor.

QUESTION 5

If Java access modifiers were listed in the order from most closed to most open, what would that list look like?

public, protected, default, private

private, default, protected, public

public, default, protected, private

private, protected, default, public

QUESTION 6

A method that gets a value from a class's attribute/field, but does not change it is called ....

accessor / getter

default constructor

void

mutator / setter

QUESTION 7

When a method variable has the same name / identifier as one of the class's attributes / fields, the method variable ............ that attribute / field.

merges with

deletes

shadows

replaces

QUESTION 8

Consider the following class:

public class someClass {

private double var = 4;

public someClass(){

this.var = 5;

}

public void setVar(double newVar){

this.var = newVar;

}

public void dummy(){

System.out.println("no var here");

}

}

What is the scope of attribute / field var?

Only setVar method

The term scope has nothing to do with attributes / fields

Entire someClass class

Only setVar method and constructor

QUESTION 9

In Java, an object is ..........

a variable

a blueprint

an instance of a class

a primitive data type

QUESTION 10

If you don't provide a constructor for your class, Java will automatically initialize all class attributes / fields using random values. True or false?

True

False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!