Re: Arrays

From: Andrew Harker (andrew_at_sadNOSPAMPLEASEgeeks.com)
Date: 07/13/04


Date: Tue, 13 Jul 2004 18:39:57 +0100


> "Univ" <Dhanesh81@intnet.mu> wrote in message
> news:ccvan7$kvo$1@news.intnet.mu...
>
>>I've got the Following assignment to do and Im getting the following
>>problem,.
>>
>>1 Create a class called ArrayDemo , --- this is OK.
>>2 define a public static method called replaceArrayElement() that takes
>>names(a reference to an array Object of String) , index(*of type int) and
>
> a
>
>>value(aString object reference) as arguments
>> -- I did this -- public static replace
>>ArrayElement(String[] names , int index , String value) - is it OK?
>>
[snip]

Univ wrote:
> I've done this so far and am stuck at step5
>
> public class ArrayDemo
> {
> public static void replaceArrayElement()
> {
> String [] names;
> int index;
> String value;
> }
>
[snip]

Nope, it looks like you are stuck at step 2. Define this function as
specified (look at how you are using it later on or in your comments
above ... although there is no return value and you try and use one
later)

Why not try out your replaceArrayElement method before you try the next
steps by calling it and printing out the values again to make sure it
is working.

Fix this first then move on to step 5 where you can use this
static method to alter the array.

-- 
Andrew


Relevant Pages

  • Re: OO conventions
    ... subclass object (likely by passing a string to the constructor, e.g., ... Image.opendefined as a static method (wait...is that ...
    (comp.lang.python)
  • Re: Can I have different instances of a subroutine?
    ... (snip, someone wrote) ... for example all the methods of the Math class in Java are static. ... A static method is normally invoked qualified by its class, ... might bring benefits in terms of code organisation, etc., and not so ...
    (comp.lang.fortran)
  • Re: Static vs. instance method: Which one performs better?
    ... yield any significant result. ... In theory a static method might be very, very, *very* slightly faster ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MT and Classes: MVP & Threading Experts Only
    ... BigFish wrote: ... for threads to be started only via the static method start, ... class can only be done by member functions or your class (either static ...
    (microsoft.public.vc.language)