What is the difference between int[] a; and int a[]; a)No difference. b)First one will give compilation error. c)Second one will give compilation error. d)First one represents array of int references. e)Second one represents array of int references. f)both represents array of int elements. What is the answer?? My answers- a,d,e
Tony Alicea
Desperado
Sheriff
Joined: Jan 30, 2000
Posts: 3219
posted
0
(a) and (f) are TRUE, IMO.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Arijit Ghosh
Greenhorn
Joined: Sep 23, 2002
Posts: 22
posted
0
What is the differenc between array of int references and array of int elements ?
Thanks,<br /> Arijit
Anthony Villanueva
Ranch Hand
Joined: Mar 22, 2002
Posts: 1055
posted
0
Originally posted by Arijit: What is the differenc between array of int references and array of int elements ?
I don't understand the question. Can you give a specfic example?
Ron Newman
Ranch Hand
Joined: Jun 06, 2002
Posts: 1056
posted
0
Do you mean the difference between int[] and Integer[] ? The first is an array of (primitive) ints, while the second is an array of references to Integer objects (wrappers for ints).
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
ints are primitives and in Java primitives never have references.
Divakar, Welcome to Javaranch We'd like you to read the Javaranch Naming Policy and change your publicly displayed name (change it here) to comply with our unique rule. Thank you. PS: Quote from the naming policy:
For your publicly displayed name, use a first name, a space, and a last name. Obviously fictitious names or improperly formatted names may be locked out.