• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

clone help

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was reading java book and i did not get the clone part.

int [] p = new int [100];
int [] s = (int[]) p.clone();

Which of the following statements will change the last value of p to 75?

A) p[99]=75; B)p[100]=75; C)s[99]=75; D)s[100]=75; E) two or more of the answers will chane i to 75
[ September 11, 2005: Message edited by: indi anj ]
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, what exactly is the question?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that part of the question is missing. The choices given don't make any sense based on the code snippet that you gave. I know it probably isn't part of your question, but it will help us understand the context so that we can provide an answer.

Layne
[ September 11, 2005: Message edited by: Layne Lund ]
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question you have posed analyses your grasp of fundamental array concepts.

The last element of a array 'p' of 100 integer elements is addressed as what ... p[100] or p[99] ? - This is the first point to be understood.

After you successfully cloned the array 'p' ... will the change in an element of the clone ... here 's' ... reflect on the original 'p' ? - This is the second point.

So, write the code


Hope this helps.
 
reply
    Bookmark Topic Watch Topic
  • New Topic