Re: declaring an array..
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigCBE7F6382D89CEF1FA3CA911
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
RedGrittyBrick schreef:
Nigel Wade wrote:
maya wrote:
hi,
I need to declare an array, but not give it a value initially; values=
will given inside conditionals.. I need to do what with strings you
would like this:
String example = "";
if ( cond1) {
example = "blue";
}
if ( cond2 ) {
example = "green";
}
how do you do this w/an array? just declare the array, then give it
values inside conditionals??? can't seem to get this right.. have
tried:
String[]pages;
// String pages[];
pages[] = {"page1", "page2", "page3", "page4",
"page5", "page6"};
all of them throw an an error.. how do you JUST DECLARE an array
without right away giving it a value?
thank you.....
String pages[];
...
pages = new String[] {"page1", "page2", "page3", "page4", "page5",
"page6"};
You can omit "new String[]"
String[] pages;
...
pages = {"page1", "page2", "page3", "page4", "page5", "page6"};
But I somehow think you might want to define the elements one by one,
like this:
pages[i] = "pagei";
H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
--------------enigCBE7F6382D89CEF1FA3CA911
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFHjNvOe+7xMGD3itQRAq4zAJ9PITj0h8AGgV9HrvWSjbfKm7KXtgCfTLLV
/c4aR1aJ4Q0FPcrwobfi2vc=
=cJ4Q
-----END PGP SIGNATURE-----
--------------enigCBE7F6382D89CEF1FA3CA911--