{"id":297,"date":"2008-10-17T18:47:26","date_gmt":"2008-10-18T00:47:26","guid":{"rendered":"http:\/\/www.lastdragon.net\/?p=297"},"modified":"2008-10-17T18:48:32","modified_gmt":"2008-10-18T00:48:32","slug":"arreglos-en-java-segundo-codigo-de-javasonicoscom","status":"publish","type":"post","link":"https:\/\/www.lastdragon.net\/?p=297","title":{"rendered":"Arreglos en Java  &#8211; Segundo c\u00f3digo de Javasonicos.com"},"content":{"rendered":"<p>Manejo de arreglos<\/p>\n<p>A continuaci\u00f3n expongo el c\u00f3digo Java publicado en Javasonicos.com y mi c\u00f3digo re codificado en .NET usando C#<\/p>\n<p><a href=\"http:\/\/www.javasonicos.com\/2008\/10\/15\/arreglos-en-java\/\">Arreglos en  Java  http:\/\/www.javasonicos.com\/2008\/10\/15\/arreglos-en-java\/<\/a><\/p>\n<p><strong>Su c\u00f3digo en Java<\/strong><\/p>\n<p>\/\/Declaramos el nombre de la clase, en nuestro caso Arreglo<\/p>\n<p>\n&nbsp; public class Arreglo {<\/p>\n<p>\n&nbsp; \/\/Declaramos el metodo principal, para que nuestra<br \/>\npeque&ntilde;a aplicaci&oacute;n pueda correr<\/p>\n<p>&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<\/p>\n<p>&nbsp; \/\/Aqui haremos la declaraci&oacute;n del arreglo, que sera de<br \/>\ntipo entero y tama&ntilde;o de 10 datos<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int arreglo[] =<br \/>\nnew int[10];<br \/>\n&nbsp;<br \/>\n&nbsp; \/\/Con un for asignaremos el llenado de nuestro arreglo que<br \/>\ninicia en cero, sera menor al tama&ntilde;o de nuestro arreglo, e ira<br \/>\nincrementando de uno en uno<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p>\n&nbsp; for (int llena = 0; llena &lt; arreglo.length; llena++) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\narreglo[llena]=llena;<br \/>\n&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n\/\/Por ultimo, haremos la impresi&oacute;n de nuestro arreglo, haciendo<br \/>\nel recorrido de este nuevamente con un for<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for<br \/>\n(int i = 0; i &lt; (arreglo.length); i++) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\nSystem.out.println(&#8220;Arreglos contenido: &#8220;+arreglo[i]+&#8221;\\n&#8221;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n}<\/p>\n<p><strong>Mi c\u00f3digo en C# .NET<\/strong><\/p>\n<p>&nbsp;&nbsp; &nbsp;public class Arreglo<br \/>\n&nbsp;&nbsp; &nbsp;{<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;public static void Main(string[]<br \/>\nargs)<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int[] arreglo<br \/>\n= new int[10];<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp; for (int llena = 0; llena &lt; arreglo.Length; llena++) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\narreglo[llena]=llena;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp; for (int i = 0; i &lt; (arreglo.Length); i++) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\nSystem.Console.WriteLine (&#8220;Arreglos contenido: &#8220;+arreglo[i]+&#8221;\\n&#8221;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br \/>\n&nbsp;&nbsp; &nbsp;}<\/p>\n<p><strong>Salida esperada de este programa<\/strong><\/p>\n<p>Arreglos contenido: 0<\/p>\n<p>Arreglos contenido: 1<\/p>\n<p>Arreglos contenido: 2<\/p>\n<p>Arreglos contenido: 3<\/p>\n<p>Arreglos contenido: 4<\/p>\n<p>Arreglos contenido: 5<\/p>\n<p>Arreglos contenido: 6<\/p>\n<p>Arreglos contenido: 7<\/p>\n<p>Arreglos contenido: 8<\/p>\n<p>Arreglos contenido: 9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Manejo de arreglos A continuaci\u00f3n expongo el c\u00f3digo Java publicado en Javasonicos.com y mi c\u00f3digo re codificado en .NET usando C# Arreglos en Java http:\/\/www.javasonicos.com\/2008\/10\/15\/arreglos-en-java\/ Su c\u00f3digo en Java \/\/Declaramos el nombre de la clase, en nuestro caso Arreglo &nbsp; public class Arreglo { &nbsp; \/\/Declaramos el metodo principal, para que nuestra peque&ntilde;a aplicaci&oacute;n pueda&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-programacion"],"_links":{"self":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=297"}],"version-history":[{"count":0,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts\/297\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}