Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java certification sample

Tags:

java

What is considered an object in this question? There are 7 doubles in the array plus the array itself.

How many objects will be present after the following code fragment has executed?

double[] ann = new double[ 7 ];
double[] bob;
bob = ann;

2 7 14 1

like image 763
user916115 Avatar asked Aug 27 '12 16:08

user916115


1 Answers

only one object new double[ 7 ];

double[] bob; also references same object created in above step.

like image 68
kosa Avatar answered Oct 21 '22 17:10

kosa