Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Assume that in a given class, Villain , the instance member xCoordinate and static member newOriginX , are both are declared public , allowing

java

Assume that in a given class, Villain, the instance member xCoordinate and static member newOriginX, are both are declared public, allowing the client to use them directly (that's fine -- maybe there is no illegal value for either, so no need to provide mutators). Consider legal and correct the client code (where the two objects are members of the class in question):

 evilVillain1.xCoordinate = 3; evilVillain1.newOriginX = -2.2; evilVillain2.xCoordinate = 5; evilVillain2.newOriginX = -1.4; 

Immediately after this code, what are the values of the instance and static members?

(We will get warnings about accessing the static member through an object vs. the class name, but for this problem we ignore the warning - it's okay.)

A evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -1.4 the class's static, if accessed through evilVillain2.newOrigin, = -1.4
B evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -2.2 the class's static, if accessed through evilVillain2.newOrigin, = -2.2
C evilVillain1 has xCoordiante = 5 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -2.2 the class's static, if accessed through evilVillain2.newOrigin, = -2.2
D evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -1.4 the class's static, if accessed through evilVillain2.newOrigin, = -2.2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

Students also viewed these Databases questions