Newbie question

Discussion in 'Javascript' started by Reinert Korsnes, Dec 9, 2005.

  1. Newbie Java question (my main progamming experience is Ada95):

    How do I make a new array (A) of length N and at the same time initiate it ?

    I can do it this way:
    A = new int [N);
    for (int i=0; i < A.length; i++){
    A = 1;

    But I find it clumsy.

    In Ada one can use:

    A : array (0..N) of Integer := (others=>1);

    Something I have been missing ?
    Possible to do the java version short, elegant and readable/relyable ?

    Reinert Korsnes, Dec 9, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.