Consider the following code fragmentRectangle r1 = new Rectangle();r1.setColor(Color.blue);Rectangle r2 = r1;r2.setColor(Color.red);After the above piece of code is executed, what are the colors of r1 andr2 (in this order)? - Study24x7
Social learning Network
study24x7

Default error msg

Login

New to Study24x7 ? Join Now
Already have an account? Login
23 Mar 2019 10:26 AM study24x7 study24x7

Consider the following code fragment
Rectangle r1 = new Rectangle();
r1.setColor(Color.blue);
Rectangle r2 = r1;
r2.setColor(Color.red);After the above ...

See more

A

Color.blue
Color.red

B

Color.blue
Color.blue

C

Color.red
Color.red

D

Color.red
Color.blue

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles