🔒 Closed Paexplain naman po ng array sa java :)

Status
Not open for further replies.
An array is a container that holds a fixed number of elements of the same type. For example, kailangan mo ng container para sa 5 names, pwede mo sabihing 'String[] names = new String[5];'

Arrays are 0-based, meaning ang access elements sa loob ng array ay nagsisimula sa 0:
Code:
 names[0] - 1st element
 names[1] - 2nd element
 ...
 names[4] - 5th element

Don't access arrays na hindi pa na-create or index it with a value that's out-of-range (n-1 valid indices where n=size)

In addition, Object ang arrays sa Java. ie reference types sila hence kailangan ng 'new' kapag mag c-create ng array.
 
Status
Not open for further replies.

About this Thread

  • 23
    Replies
  • 1K
    Views
  • 12
    Participants
Last reply from:
anjum12345678

Trending Topics

Online now

Members online
1,044
Guests online
1,400
Total visitors
2,444

Forum statistics

Threads
2,274,222
Posts
28,954,382
Members
1,234,150
Latest member
A313
Back
Top