<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Manual Web &#187; array</title>
	<atom:link href="http://www.manualweb.net/tag/array/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manualweb.net</link>
	<description>www.manualweb.net</description>
	<lastBuildDate>Tue, 24 Aug 2010 00:26:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Arrays en VBScript</title>
		<link>http://www.manualweb.net/vbscript/arrays-en-vbscript/</link>
		<comments>http://www.manualweb.net/vbscript/arrays-en-vbscript/#comments</comments>
		<pubDate>Fri, 28 May 2010 22:22:57 +0000</pubDate>
		<dc:creator>manualweb</dc:creator>
				<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[DIM]]></category>
		<category><![CDATA[matriz]]></category>
		<category><![CDATA[preserve]]></category>
		<category><![CDATA[redim]]></category>
		<category><![CDATA[redimensionar]]></category>
		<category><![CDATA[UBound]]></category>

		<guid isPermaLink="false">http://www.manualweb.net/?p=273</guid>
		<description><![CDATA[Declarar un Array Recorriendo el Array Arrays de múltiples tipos Redimensionar un Array Ejemplos de Código relacionados Declarar un Array Para declarar un array en VBScript bastará con declarar una variable que tenga un rango, el cual establecerá el tamaño del array. Cada rango será una dimensión del array, así un array con dos dimensiones [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://www.manualweb.net/vbscript/arrays-en-vbscript/#toc-declarar-un-array">Declarar un Array</a></li>
<li><a href="http://www.manualweb.net/vbscript/arrays-en-vbscript/#toc-recorriendo-el-array">Recorriendo el Array</a></li>
<li><a href="http://www.manualweb.net/vbscript/arrays-en-vbscript/#toc-arrays-de-multiples-tipos">Arrays de múltiples tipos</a></li>
<li><a href="http://www.manualweb.net/vbscript/arrays-en-vbscript/#toc-redimensionar-un-array">Redimensionar un Array</a></li>
<li><a href="http://www.manualweb.net/vbscript/arrays-en-vbscript/#toc-ejemplos-de-codigo-relacionados">Ejemplos de Código relacionados</a></li>
</ol>
</div>
<h3 id="toc-declarar-un-array">Declarar un Array</h3>
<p>Para declarar un array en VBScript bastará con declarar una variable que tenga un rango, el cual establecerá el tamaño del array. Cada rango será una dimensión del array, así un array con dos dimensiones será una matriz. El límite de dimensiones en VBScript es de 60.</p>
<p>Veamos como se declara un array:</p>
<pre>DIM miArray (3)
DIM miMatriz (2,10)</pre>
<p>Cuando estamos declarando un array de x posiciones, este, tiene como tamaño x+1. En los casos anteriores tendrían una longitud de 4 en el primero y 3,11 en el segundo de los casos.</p>
<p>Para acceder a un determinado elemento del array lo haremos de la siguiente forma:</p>
<pre>miArray(posicion)
'Si se tratase de una matriz
miArray(posicion,posicion)</pre>
<p>Ya sea para mostrar su valor:</p>
<pre>document.write (miArray(posicion))</pre>
<p>o para modificarlo:</p>
<pre>miArray(posicion) = valor</pre>
<h3 id="toc-recorriendo-el-array">Recorriendo el Array</h3>
<p>Para mostrar todo el contenido de un array nos podemos ayudar de alguna sentencia de control de flujo repetitiva. Veamos como mostrarlo mediante un bucle for.</p>
<pre>for x=0 to UBound(miArray)
  document.write(miArray(x))
next</pre>
<p>Para controlar el tamaño del array utilizamos la función <a title="UBound()" href="http://w3api.com/wiki/VBScript:Ubound">UBound(array)</a>.</p>
<h3 id="toc-arrays-de-multiples-tipos">Arrays de múltiples tipos</h3>
<p>Una de las características principales de los arrays en VBScript es que estos pueden albergar datos de diferentes tipos. Es decir, no tenemos que declarar un array ded Strings o de enteros, sino que el array puede contener strings y entreros al mismo tiempo.</p>
<p>Así podriamos tener el siguiente código:</p>
<pre>miArray(0) = "Cadena"
miArray(1) = 4
miArray(2) = #16/09/1976#
miArray(3) = true</pre>
<h3 id="toc-redimensionar-un-array">Redimensionar un Array</h3>
<p>La segunda de las características de los arrays es que pueden ser redimensionados, es decir, que podemos cambiar el tamaño del array una vez que este ha sido declarado. Solo se podrán redimensionar los arrays que se hayan declarado sin dimensión.</p>
<p>Para redimensionar un array utilizaremos la sentencia redim. La redimensión puede ser tanto para aumentar como para disminuir su tamaño.</p>
<pre>DIM miArray()
REDIM miArray(2)</pre>
<p>Si redimensionamos el array tal cual, perderemos su contenido. Para evitar esto utilizaremos la clausula preserve.</p>
<pre>REDIM PRESERVE miArray(2)</pre>
<h3 id="toc-ejemplos-de-codigo-relacionados">Ejemplos de Código relacionados</h3>
<ul>
<li><a title="Recorrer una matriz en VBScript" href="http://lineadecodigo.com/vbscript/recorrer-una-matriz-en-vbscript/">Recorrer una matriz en VBScript</a></li>
<li><a title="Redimensionar un array con VBScript" href="http://lineadecodigo.com/vbscript/redimensionar-un-array-con-vbscript/">Redimensionar un array con VBScript</a></li>
</ul>

<div class="sociable">
<div class="sociable_tagline">
<strong>Comparteme:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;title=Arrays%20en%20VBScript&amp;bodytext=%0ADeclarar%20un%20Array%0ARecorriendo%20el%20Array%0AArrays%20de%20m%C3%BAltiples%20tipos%0ARedimensionar%20un%20Array%0AEjemplos%20de%20C%C3%B3digo%20relacionadosDeclarar%20un%20Array%0D%0APara%20declarar%20un%20array%20en%20VBScript%20bastar%C3%A1%20con%20declarar%20una%20variable%20que%20tenga%20un%20rango%2C%20el%20cual%20establecer%C3" title="Digg"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F" title="Sphinn"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;title=Arrays%20en%20VBScript&amp;notes=%0ADeclarar%20un%20Array%0ARecorriendo%20el%20Array%0AArrays%20de%20m%C3%BAltiples%20tipos%0ARedimensionar%20un%20Array%0AEjemplos%20de%20C%C3%B3digo%20relacionadosDeclarar%20un%20Array%0D%0APara%20declarar%20un%20array%20en%20VBScript%20bastar%C3%A1%20con%20declarar%20una%20variable%20que%20tenga%20un%20rango%2C%20el%20cual%20establecer%C3" title="del.icio.us"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;t=Arrays%20en%20VBScript" title="Facebook"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;title=Arrays%20en%20VBScript" title="Mixx"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;title=Arrays%20en%20VBScript&amp;annotation=%0ADeclarar%20un%20Array%0ARecorriendo%20el%20Array%0AArrays%20de%20m%C3%BAltiples%20tipos%0ARedimensionar%20un%20Array%0AEjemplos%20de%20C%C3%B3digo%20relacionadosDeclarar%20un%20Array%0D%0APara%20declarar%20un%20array%20en%20VBScript%20bastar%C3%A1%20con%20declarar%20una%20variable%20que%20tenga%20un%20rango%2C%20el%20cual%20establecer%C3" title="Google Bookmarks"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F&amp;title=Arrays%20en%20VBScript" title="Live"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.manualweb.net%2Fvbscript%2Farrays-en-vbscript%2F" title="Meneame"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/meneame.png" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.manualweb.net/vbscript/arrays-en-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arrays en Java</title>
		<link>http://www.manualweb.net/java/arrays-en-java/</link>
		<comments>http://www.manualweb.net/java/arrays-en-java/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 19:47:19 +0000</pubDate>
		<dc:creator>manualweb</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[inicialización]]></category>
		<category><![CDATA[length()]]></category>
		<category><![CDATA[matriz]]></category>
		<category><![CDATA[subindice]]></category>
		<category><![CDATA[tamaño]]></category>

		<guid isPermaLink="false">http://www.manualweb.net/?p=185</guid>
		<description><![CDATA[¿Qué es un array? Tamaño del array: .length Matrices o Arrays de varios subindices Incialización de Arrays ¿Qué es un array? Un array es una estructura de datos que nos permite almacenar una ristra de datos de un mismo tipo. El tamaño de los arrays se declara en un primer momento y no puede cambiar [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://www.manualweb.net/java/arrays-en-java/#toc-que-es-un-array">¿Qué es un array?</a></li>
<li><a href="http://www.manualweb.net/java/arrays-en-java/#toc-tamano-del-array-length">Tamaño del array: .length</a></li>
<li><a href="http://www.manualweb.net/java/arrays-en-java/#toc-matrices-o-arrays-de-varios-subindices">Matrices o Arrays de varios subindices</a></li>
<li><a href="http://www.manualweb.net/java/arrays-en-java/#toc-incializacion-de-arrays">Incialización de Arrays</a></li>
</ol>
</div>
<h3 id="toc-que-es-un-array">¿Qué es un array?</h3>
<p>Un array es una estructura de datos que nos permite almacenar una ristra de datos de un mismo tipo. El tamaño de los arrays se declara en un primer momento y no puede cambiar en tiempo de ejecución como puede producirse en otros lenguajes.</p>
<p>La declaración de un array en Java y su inicialización se realiza de la siguiente manera:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tipo_dato nombre_array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">nombre_array = <span style="color: #000000; font-weight: bold;">new</span> tipo_dato<span style="color: #66cc66;">&#91;</span>tamaño<span style="color: #66cc66;">&#93;</span>;</div></li></ol></pre>
<p>Por ejemplo, podríamos declarar un array de caracteres e inicializarlo de la siguiente manera:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">char</span> arrayCaracteres<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arrayCaracteres = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">char</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#93;</span>;</div></li></ol></pre>
<p>Los arrays se numeran desde el elemento cero, que sería el primer elemento, hasta el tamaño-1 que sería el último elemento. Es decir, si tenemos un array de diez elementos, el primer elemento sería el cero y el último elemento sería el nueve.</p>
<p>Para acceder a un elemento especifico utilizaremos los corchetes de la siguiente forma. Entendemos por acceso, tanto el intentar leer el elemento, como asignarle un valor.</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arrayCaracteres<span style="color: #66cc66;">&#91;</span>numero_elemento<span style="color: #66cc66;">&#93;</span>;</div></li></ol></pre>
<p>Por ejemplo, para acceder al tercer elemento lo haríamos de la siguiente forma:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Lectura de su valor.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">char</span> x = arrayCaracteres<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Asignación de un valor. Como se puede comprobar se pone el  número dos, que coincide con el tercer elemento. Ya que como  dijimos anteriormente el primer elemento es el cero.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arrayCaracteres<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'b'</span>;</div></li></ol></pre>
<p>El objeto array, aunque podríamos decir que no existe como tal, posee una variable, la cual podremos utilizar para facilitar su manejo.</p>
<h3 id="toc-tamano-del-array-length">Tamaño del array: .length</h3>
<p>Esta variable nos devuelve el número de elementos que posee el array. Hay que tener en cuenta que es una variable de solo lectura, es por ello que no podremos realizar una asignación a dicha variable.</p>
<p>Por ejemplo esto nos serviría a la hora de mostrar el contenido de los elementos de un array:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">char</span> array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">array = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">char</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> x=<span style="color: #cc66cc;">0</span>;x&lt;array.<span style="color: #006600;">length</span>;x++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span> <span style="color: #66cc66;">&#40;</span>array<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<blockquote><p>Uno de los axiomas de la orientación a objetos es la ocultación, es decir, que no podemos acceder a una variable declarada dentro de una clase a no ser que lo hagamos a traves de un método de la clase. Aquí estamos accediendo a una variable. ¿Quizás sea por que no consideran a los arrays como objetos?.</p></blockquote>
<h3 id="toc-matrices-o-arrays-de-varios-subindices">Matrices o Arrays de varios subindices</h3>
<p>Podremos declarar arrays de varios subíndices, pudiendo tener arrays de dos niveles, que serían similares a las matrices, arrays de tres niveles, que serían como cubos y así sucesivamente, si bien a partir del tercer nivel se pierde la perspectiva geométrica.</p>
<p>Para declarar e inicializar un array de varios subíndices lo haremos de la siguiente manera:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tipo_dato nombre_array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">nombre_array = <span style="color: #000000; font-weight: bold;">new</span> tipo_dato<span style="color: #66cc66;">&#91;</span>tamaño<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>tamaño<span style="color: #66cc66;">&#93;</span>;</div></li></ol></pre>
<p>De esta forma podemos declarar una matriz de 2x2 de la siguiente forma:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> matriz<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">matriz = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>;</div></li></ol></pre>
<p>El acceso se realiza de la misma forma que antes:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> x = matriz<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// Para leer el contenido de un elemento</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">matriz<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = x;     <span style="color: #808080; font-style: italic;">// Para asignar un valor.</span></div></li></ol></pre>
<p>Hay que tener en cuenta que para mostrar su contenido tendremos que utilizar dos bucles. Para saber el número de columnas lo haremos igual que antes mediante la variable length, pero para saber el numero de filas que contiene cada columna lo tendremos que realizar de la siguiente manera:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">matriz<span style="color: #66cc66;">&#91;</span>numero_elemento<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">lenght</span>;</div></li></ol></pre>
<p>Nuestra lectura de los elementos de una matriz quedaría de la siguiente forma:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> matriz<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">matriz = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> x=<span style="color: #cc66cc;">0</span>; x &lt; matrix.<span style="color: #006600;">length</span>; x++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> y=<span style="color: #cc66cc;">0</span>; y &lt; matriz<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">length</span>; y++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span> <span style="color: #66cc66;">&#40;</span>matriz<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>y<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<h3 id="toc-incializacion-de-arrays">Incialización de Arrays</h3>
<p>Existe una forma de inicializar un array con el contenido, amoldándose su tamaño al número de elementos a los que le inicialicemos. Para inicializar un array utilizaremos las llaves de la siguiente forma:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tipo_dato array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span>elemento1,elemento2,...,elementoN<span style="color: #66cc66;">&#125;</span>;</div></li></ol></pre>
<p>Así, por ejemplo, podríamos inicializar un array o una matriz:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Tenemos un array de 5 elementos.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">char</span> array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span><span style="color: #ff0000;">'a'</span>,<span style="color: #ff0000;">'b'</span>,<span style="color: #ff0000;">'c'</span>,<span style="color: #ff0000;">'d'</span>,<span style="color: #ff0000;">'e'</span><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Tenemos un array de 4x4 elementos.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> array<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">7</span>,<span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#125;</span>;</div></li></ol></pre>

<div class="sociable">
<div class="sociable_tagline">
<strong>Comparteme:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;title=Arrays%20en%20Java&amp;bodytext=%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0ATama%C3%B1o%20del%20array%3A%20.length%0AMatrices%20o%20Arrays%20de%20varios%20subindices%0AIncializaci%C3%B3n%20de%20Arrays%0D%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0D%0AUn%20array%20es%20una%20estructura%20de%20datos%20que%20nos%20permite%20almacenar%20una%20ristra%20de%20datos%20de%20un%20mismo%20tipo.%20El%20tama%C3%B1o%20de%20lo" title="Digg"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F" title="Sphinn"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;title=Arrays%20en%20Java&amp;notes=%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0ATama%C3%B1o%20del%20array%3A%20.length%0AMatrices%20o%20Arrays%20de%20varios%20subindices%0AIncializaci%C3%B3n%20de%20Arrays%0D%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0D%0AUn%20array%20es%20una%20estructura%20de%20datos%20que%20nos%20permite%20almacenar%20una%20ristra%20de%20datos%20de%20un%20mismo%20tipo.%20El%20tama%C3%B1o%20de%20lo" title="del.icio.us"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;t=Arrays%20en%20Java" title="Facebook"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;title=Arrays%20en%20Java" title="Mixx"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;title=Arrays%20en%20Java&amp;annotation=%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0ATama%C3%B1o%20del%20array%3A%20.length%0AMatrices%20o%20Arrays%20de%20varios%20subindices%0AIncializaci%C3%B3n%20de%20Arrays%0D%0A%C2%BFQu%C3%A9%20es%20un%20array%3F%0D%0AUn%20array%20es%20una%20estructura%20de%20datos%20que%20nos%20permite%20almacenar%20una%20ristra%20de%20datos%20de%20un%20mismo%20tipo.%20El%20tama%C3%B1o%20de%20lo" title="Google Bookmarks"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F&amp;title=Arrays%20en%20Java" title="Live"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://meneame.net/submit.php?url=http%3A%2F%2Fwww.manualweb.net%2Fjava%2Farrays-en-java%2F" title="Meneame"><img src="http://www.manualweb.net/wp-content/plugins/sociable/images/meneame.png" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.manualweb.net/java/arrays-en-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
