The Artima Developer Community
Sponsored Link

Java Answers Forum
need help on exercise

2 replies on 1 page. Most recent reply: Sep 14, 2005 5:05 AM by Jeff Thomson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
indi

Posts: 2
Nickname: indianj
Registered: Sep, 2005

need help on exercise Posted: Sep 12, 2005 5:44 PM
Reply to this message Reply
Advertisement
i was doing my exercise and i did not get it this one.

int [] p = new int [100];
int [] s = p;

after these statements, 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 of more of the answers will change p to 75.


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: need help on exercise Posted: Sep 12, 2005 9:58 PM
Reply to this message Reply
> i was doing my exercise and i did not get it this one.
>
> int [] p = new int [100];
> int [] s = p;
>

Google Java array Tutorial as well as Java Objects
(You need to know about Objects because you have
equated the references hence changes in p apply to
s). Short of that, me simply giving you the answer
is beyond ridiculous.

Jeff Thomson

Posts: 14
Nickname: thomson
Registered: Sep, 2005

Re: need help on exercise Posted: Sep 14, 2005 5:05 AM
Reply to this message Reply
When it’s an assignment you are expected to do it yourself it’s not fair to ask others do it for you. Just go thru these tutorials and give it a try. If you still don’t succeed post some code which you wrote to try this exercise.

http://java.sun.com/docs/books/tutorial/java/data/arrays.html
http://java.sun.com/docs/books/tutorial/java/data/index.html

---------------
Jeff Thomson
http://www.devsquare.com
Online Application Development

Flat View: This topic has 2 replies on 1 page
Topic: unexpected error, hotspot VM! Previous Topic   Next Topic Topic: casting...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use