What is the value of a field

Report a typo

Suppose you have the following class in your program:

class Hotel {
    String name;
    String address;
    int rating;
}

There are several objects of the class:

Hotel h1 = new Hotel();
Hotel h2 = new Hotel();
Hotel h3 = h2;

h2.rating = 9;
h3.rating = 8;
h1.rating = 7;

What is the value of h2.rating after executing the code above?

Select one option from the list
___

Create a free account to access the full topic