3 Replies - 331 Views - Last Post: 08 June 2009 - 08:38 PM Rate Topic: -----

#1 viuc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 09

easy 'array' q

Posted 08 June 2009 - 08:21 PM

Hello... if I have the following code in the main method

-

int num1 = 10;
int [] num2;
int num3 = 15;
num2 = new int[num1];
num2[1] = num3;

-
After the code has been executed is it true to say that
"num2 refers to an array with 10 elements of type int."

thx
Is This A Good Question/Topic? 0
  • +

Replies To: easy 'array' q

#2 phil1000  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 176
  • Joined: 26-February 09

Re: easy 'array' q

Posted 08 June 2009 - 08:32 PM

Yes, that's true.
Was This Post Helpful? 0
  • +
  • -

#3 viuc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 09

Re: easy 'array' q

Posted 08 June 2009 - 08:34 PM

thx phil mwa xx :wub: :^:
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: easy 'array' q

Posted 08 June 2009 - 08:38 PM

View Postviuc, on 8 Jun, 2009 - 07:21 PM, said:

Hello... if I have the following code in the main method

-

int num1 = 10;
int [] num2;
int num3 = 15;
num2 = new int[num1];
num2[1] = num3;

-
After the code has been executed is it true to say that
"num2 refers to an array with 10 elements of type int."

thx

The other statements are jhust faked

int num1 = 10;
int [] num2;
num2 = new int[num1];

are sufficient to prove your case
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1