FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   initializing an array
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: initializing an array  (Read 205 times)
der_rabe

343748541343748541 WWW
initializing an array
« on: Dec 24th, 2003, 10:09pm »

hi folks
merry christmas to all of you.
 
here is my question. it is more a java question than a processing question.  
 
i use an int-array with two dimensions in my programm. now i want to initialize every element in the array with the same value (0) as simple as possible. i tried the Arrays.fill method from the javaclass: java.util.Arrays but it seems to be restricted to arrays with one dimension. is there a method for more complex arrays?
i know how to write my own method to initialize my array, but i just wonder if java provides such a method.
 
thanks a lot.
 

Bernd Salewski
student of digital media
Hochschule Bremen
arielm

WWW
Re: initializing an array
« Reply #1 on: Dec 24th, 2003, 11:14pm »

as far as i know, arrays of ints are filled with 0's when you create them.
 
+ a bet: the java.util.Arrays methods you mentioned seem to be post java 1.1, so they won't work when exported to an applet (a lot of web users are still working with microsoft jvm or apple mrj)
 

Ariel Malka | www.chronotext.org
der_rabe

343748541343748541 WWW
Re: initializing an array
« Reply #2 on: Dec 25th, 2003, 12:25pm »

oh thats new to me that applet work only with the java 1.1 API. is that true? i have to consider that in the future.
 

Bernd Salewski
student of digital media
Hochschule Bremen
arielm

WWW
Re: initializing an array
« Reply #3 on: Dec 25th, 2003, 12:52pm »

actually, it's not that applets are working only with 1.1, but rather that a lot of useful stuff from the java api won't work with 1.1.
 
for example: if you look into the java 1.4 api docs, you'll notice a lot of "since JDK 1.2" or "since JDK 1.3" mentions.
 

Ariel Malka | www.chronotext.org
der_rabe

343748541343748541 WWW
Re: initializing an array
« Reply #4 on: Dec 25th, 2003, 6:11pm »

by the way, you were right when you assumed that int-arrays initialize automatically with 0. i used the array without initializing and it worked as i wanted it to work.
 
 

Bernd Salewski
student of digital media
Hochschule Bremen
Pages: 1 

« Previous topic | Next topic »