<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Linea de Codigo</title>
	
	<link>http://lineadecodigo.com</link>
	<description>/* Programación en la red */</description>
	<lastBuildDate>Tue, 07 Sep 2010 06:00:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LineaDeCodigo" /><feedburner:info uri="lineadecodigo" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Definir una variable en VBScript</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/6C4QeGETgMk/</link>
		<comments>http://lineadecodigo.com/vbscript/definir-una-variable-en-vbscript/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 06:00:40 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[VBScript]]></category>
		<category><![CDATA[dim]]></category>
		<category><![CDATA[entero]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[tipo]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2580</guid>
		<description><![CDATA[Si queremos definir un valor variable en VBScript deberemos de utilizar la clausula DIM.
DIM variable
Así para definir la variable nombre haremos lo siguiente:
DIM nombre
Mediante el símbolo igual le podremos asignar un valor
DIM nombre = &#34;Victor&#34;
Si bien es verdad que el compilador no se queja si omitimos la sentencia DIM. así podremos definir una variable mediante [...]]]></description>
			<content:encoded><![CDATA[<p>Si queremos definir un valor variable en <a href="http://www.manualweb.net/tutorial-vbscript/" title="VBScript">VBScript</a> deberemos de utilizar la clausula DIM.</p>
<pre><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;">DIM variable</div></li></ol></pre>
<p>Así para definir la variable nombre haremos lo siguiente:</p>
<pre><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;">DIM nombre</div></li></ol></pre>
<p>Mediante el símbolo igual le podremos asignar un valor</p>
<pre><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;">DIM nombre = &quot;Victor&quot;</div></li></ol></pre>
<p>Si bien es verdad que el compilador no se queja si omitimos la sentencia DIM. así podremos definir una variable mediante la línea de código</p>
<pre><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;">&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;">nombre = &quot;Victor&quot;</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></ol></pre>
<p>Una cosa importante es que no se define el tipo de la variable, si no que en el momento que asignamos un valor a una variable, a dicha variable se le asgina un tipo. Así, la variable nombre, después de la asignación, será de tipo String.</p>
<p>Si bien, en la siguiente línea, podemos hacer lo siguiente:</p>
<pre><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;">&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;">nombre = 23</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></ol></pre>
<p>Automáticamente, la variable nombre, pasa a ser de tipo entero.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/vbscript/conocer-el-tipo-de-una-variable-en-vbscript/" rel="bookmark" title="Septiembre 2, 2010">Conocer el tipo de una variable en VBScript</a></li>
<li><a href="http://lineadecodigo.com/asp/paso-de-parametros-con-asp/" rel="bookmark" title="Enero 14, 2009">Paso de parámetros con ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/recuperar-datos-de-un-formulario-con-asp/" rel="bookmark" title="Marzo 8, 2009">Recuperar datos de un formulario con ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/obtener-id-de-sesion-en-asp/" rel="bookmark" title="Septiembre 21, 2009">Obtener ID de sesión en ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/variables-del-servidor-con-asp/" rel="bookmark" title="Enero 8, 2009">Variables del servidor con ASP</a></li>
</ul>
<p><!-- Similar Posts took 3.547 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/ewpj68m_84IjSADGxBzGdQxEkfo/0/da"><img src="http://feedads.g.doubleclick.net/~a/ewpj68m_84IjSADGxBzGdQxEkfo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ewpj68m_84IjSADGxBzGdQxEkfo/1/da"><img src="http://feedads.g.doubleclick.net/~a/ewpj68m_84IjSADGxBzGdQxEkfo/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=6C4QeGETgMk:p4IS0gynJOg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=6C4QeGETgMk:p4IS0gynJOg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=6C4QeGETgMk:p4IS0gynJOg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=6C4QeGETgMk:p4IS0gynJOg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=6C4QeGETgMk:p4IS0gynJOg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=6C4QeGETgMk:p4IS0gynJOg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=6C4QeGETgMk:p4IS0gynJOg:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/6C4QeGETgMk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/vbscript/definir-una-variable-en-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/vbscript/definir-una-variable-en-vbscript/</feedburner:origLink></item>
		<item>
		<title>Función con parámetros variables en Javascript</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/XTvNw4d23VE/</link>
		<comments>http://lineadecodigo.com/javascript/funcion-con-parametros-variables-en-javascript/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 06:00:27 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[argumentos]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[función]]></category>
		<category><![CDATA[objeto]]></category>
		<category><![CDATA[parametros]]></category>
		<category><![CDATA[parámetros variables]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2589</guid>
		<description><![CDATA[Una función, en toda su definición básica tiene varias partes: nombre, parámetros y el cuerpo.
function nombre&#40;param1, param2,..., paramN&#41;&#123; ...&#125;
Como podemos ver, todo y cada uno de los parámetros que le pasamos están bien definidos como argumentos. Pero en Javascript tenemos la posibilidad de que los parámetros de la función sean variables, es decir, que podamos [...]]]></description>
			<content:encoded><![CDATA[<p>Una función, en toda su definición básica tiene varias partes: nombre, parámetros y el cuerpo.</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> nombre<span style="color: #66cc66;">&#40;</span>param1, param2,..., paramN<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;"> ...</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>
<p>Como podemos ver, todo y cada uno de los parámetros que le pasamos están bien definidos como argumentos. Pero en <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a> tenemos la posibilidad de que los parámetros de la función sean variables, es decir, que podamos invocarla con más o menos parámetros, con unos u otros parámetros, dependiendo de la situación.</p>
<p>La idea sería poder tener las siguientes invocaciones de la función:</p>
<pre class="javascript"><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;">calculardatos<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</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;">calculardatos<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span>,<span style="color: #CC0000;">4</span>,<span style="color: #CC0000;">6</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;">calculardatos<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span>,<span style="color: #CC0000;">4</span>,<span style="color: #CC0000;">6</span>,<span style="color: #CC0000;">8</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Como vemos, la cantidad de números varía en cada invocación. Incluso podríamos realizar la siguiente invocación:</p>
<pre class="javascript"><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;">calculardatos<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span>,<span style="color: #3366CC;">&quot;texto&quot;</span>,<span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>En este caso estamos invocando con parámetros de diferente tipo: entero, cadena y booleano.</p>
<p>Un caso de uso es cuando queramos realizar validaciones sobre una estructura de datos sobre la cual el usuario puede añadir mas o menos registros. Por ejemplo, un formulario al cual vamos añadiendo más campos de forma dinámica.</p>
<p>Pero vamos a ver como codificar la función. Para poder tener parámetros variables nos apoyamos en el elemento arguments. Toda función tiene un objeto arguments el cual representa un array com los valores de los argumentos los cuales fueron pasados en la invocación.</p>
<p>Así, una función que simplemente listase los parámetros que se le han pasado como argumentos sería la siguiente:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> calculardatos <span style="color: #66cc66;">&#40;</span><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;">  document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Invocación recibida&quot;</span> + <span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</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: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span>x=<span style="color: #CC0000;">0</span>;x&lt;arguments.<span style="color: #006600;">length</span>;x++<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;">    document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span>arguments<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span> + <span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</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>
<p>Una vez controlado el objeto arguments, las posibilidades son infinitas.</p>
<p>¿Qué caso de uso se te ocurre para codificar una función con parámetros variables?<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/vbscript/conocer-el-tipo-de-una-variable-en-vbscript/" rel="bookmark" title="Septiembre 2, 2010">Conocer el tipo de una variable en VBScript</a></li>
<li><a href="http://lineadecodigo.com/javascript/obtener-el-dominio-de-la-url-con-javascript/" rel="bookmark" title="Enero 18, 2008">Obtener el dominio de la URL con JavaScript</a></li>
<li><a href="http://lineadecodigo.com/java/leer-parametros-de-inicializacion-de-un-servlet/" rel="bookmark" title="Noviembre 11, 2006">Leer parámetros de inicialización de un servlet</a></li>
<li><a href="http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/" rel="bookmark" title="Septiembre 3, 2010">Crear un objeto con métodos en Javascript</a></li>
<li><a href="http://lineadecodigo.com/html/generar-un-documento-html-mediante-javascript/" rel="bookmark" title="Junio 28, 2007">Generar un documento HTML mediante JavaScript</a></li>
</ul>
<p><!-- Similar Posts took 2.692 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/KWo51e4WF3PaQY5ui5gdrl3rmHY/0/da"><img src="http://feedads.g.doubleclick.net/~a/KWo51e4WF3PaQY5ui5gdrl3rmHY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KWo51e4WF3PaQY5ui5gdrl3rmHY/1/da"><img src="http://feedads.g.doubleclick.net/~a/KWo51e4WF3PaQY5ui5gdrl3rmHY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=XTvNw4d23VE:Ea_gf_rZb8Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=XTvNw4d23VE:Ea_gf_rZb8Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=XTvNw4d23VE:Ea_gf_rZb8Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=XTvNw4d23VE:Ea_gf_rZb8Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=XTvNw4d23VE:Ea_gf_rZb8Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=XTvNw4d23VE:Ea_gf_rZb8Y:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=XTvNw4d23VE:Ea_gf_rZb8Y:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/XTvNw4d23VE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/javascript/funcion-con-parametros-variables-en-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/javascript/funcion-con-parametros-variables-en-javascript/</feedburner:origLink></item>
		<item>
		<title>Calcular signo del zodiaco con Java</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/sce6eTAmXtU/</link>
		<comments>http://lineadecodigo.com/java/calcular-signo-del-zodiaco-con-java/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 06:00:19 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[nextInt]]></category>
		<category><![CDATA[Scanner]]></category>
		<category><![CDATA[signo zodiaco]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2576</guid>
		<description><![CDATA[En este ejemplo vamos a ver como, mediante el lenguaje Java, podemos saber el signo del zodiaco de una persona, dada su fecha de nacimiento (día y mes).
Lo primero será pedirle al usuario su día y mes de nacimiento. Esto lo hacemos accediendo a la consola con la clase Scanner:
Scanner reader = new Scanner&#40;System.in&#41;;&#160;System.out.println&#40;&#34;Qué día [...]]]></description>
			<content:encoded><![CDATA[<p>En este ejemplo vamos a ver como, mediante el lenguaje <a href="http://www.manualweb.net/tutorial-java/" title="Java">Java</a>, podemos saber el signo del zodiaco de una persona, dada su fecha de nacimiento (día y mes).</p>
<p>Lo primero será pedirle al usuario su día y mes de nacimiento. Esto lo hacemos <a href="http://lineadecodigo.com/java/lectura-de-datos-en-java-con-scanner/" title="lectura de consola con Scanner">accediendo a la consola con la clase Scanner</a>:</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;">Scanner reader = <span style="color: #000000; font-weight: bold;">new</span> Scanner<span style="color: #66cc66;">&#40;</span><a href="http://w3api.com/wiki/Java:System"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">in</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;">&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;"><a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Qué día naciste&quot;</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;">dia = reader.<span style="color: #006600;">nextInt</span><span style="color: #66cc66;">&#40;</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;">&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;"><a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Qué mes naciste&quot;</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;">mes = reader.<span style="color: #006600;">nextInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Una vez que tenemos el día y el mes veamos la lógica a aplicar. En un mes solo puede haber dos signos del zodiaco. Por ejemplo, en Enero, si naciste antes del 21 eres Capricornio y si naciste el 21 o algún día posterior del mes de Enero, eres Acuario.</p>
<p>Otro ejemplo, el mes de noviembre. Si naciste antes del 23 eres Escorpio y si naciste el mismo 23 o día superior eres Sagitario.</p>
<p>Con esta dedución vemos que las estructuras a aplicar son sencillas. En primer lugar utilizremos la sentencia switch pasa posicionarnos en el mes:</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: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>mes<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;">case</span> <span style="color: #cc66cc;">1</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: #808080; font-style: italic;">// Enero</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: #000000; font-weight: bold;">break</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;">case</span> <span style="color: #cc66cc;">2</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: #808080; font-style: italic;">// Febrero</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: #000000; font-weight: bold;">break</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;">  ...</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>
<p>Y luego, dentro de cada mes la sentencia de decisión que aplicaremos mediante una sentencia if:</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: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>mes<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;">case</span> <span style="color: #cc66cc;">1</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: #808080; font-style: italic;">// Enero</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;">if</span> <span style="color: #66cc66;">&#40;</span>dia&gt;=<span style="color: #cc66cc;">21</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;">      <a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Acuario&quot;</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: #b1b100;">else</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://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Capricornio&quot;</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: #000000; font-weight: bold;">break</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;">case</span> <span style="color: #cc66cc;">2</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: #808080; font-style: italic;">// Febrero</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;">if</span> <span style="color: #66cc66;">&#40;</span>dia&gt;=<span style="color: #cc66cc;">20</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;">      <a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Piscis&quot;</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: #b1b100;">else</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://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Acuario&quot;</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: #000000; font-weight: bold;">break</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;">  ...</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>
<p>Como vemos la implementación es muy sencilla y nos ayuda a enteder fácilmente las sentencias de decisión if y switch.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/sumar-dos-numeros-con-java/" rel="bookmark" title="Enero 22, 2009">Sumar dos números con Java</a></li>
<li><a href="http://lineadecodigo.com/java/restar-dos-numeros-con-java/" rel="bookmark" title="Septiembre 4, 2010">Restar dos números con Java</a></li>
<li><a href="http://lineadecodigo.com/java/numeros-divisibles-con-java/" rel="bookmark" title="Julio 28, 2009">Números divisibles con Java</a></li>
<li><a href="http://lineadecodigo.com/java/notas-americanas/" rel="bookmark" title="Abril 9, 2007">Notas Americanas</a></li>
<li><a href="http://lineadecodigo.com/java/ultimo-digito-de-un-numero-con-java/" rel="bookmark" title="Enero 11, 2009">Último dígito de un número con Java</a></li>
</ul>
<p><!-- Similar Posts took 2.768 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/Z75px2TCCwsIRIO2jsrIQq9ibmA/0/da"><img src="http://feedads.g.doubleclick.net/~a/Z75px2TCCwsIRIO2jsrIQq9ibmA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Z75px2TCCwsIRIO2jsrIQq9ibmA/1/da"><img src="http://feedads.g.doubleclick.net/~a/Z75px2TCCwsIRIO2jsrIQq9ibmA/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=sce6eTAmXtU:Jf2P5qxH7AY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=sce6eTAmXtU:Jf2P5qxH7AY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=sce6eTAmXtU:Jf2P5qxH7AY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=sce6eTAmXtU:Jf2P5qxH7AY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=sce6eTAmXtU:Jf2P5qxH7AY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=sce6eTAmXtU:Jf2P5qxH7AY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=sce6eTAmXtU:Jf2P5qxH7AY:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/sce6eTAmXtU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/calcular-signo-del-zodiaco-con-java/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/calcular-signo-del-zodiaco-con-java/</feedburner:origLink></item>
		<item>
		<title>Restar dos números con Java</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/AmSkWERQmc8/</link>
		<comments>http://lineadecodigo.com/java/restar-dos-numeros-con-java/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 06:00:12 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[nextInt]]></category>
		<category><![CDATA[numeros]]></category>
		<category><![CDATA[resta]]></category>
		<category><![CDATA[Scanner]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2570</guid>
		<description><![CDATA[Ya teníamos publicados un grupo de ejemplos que nos enseñaban a realizar algunas de las operaciones matemáticas básicas: suma, multiplicación y división. Si bien, como muchos nos habéis indicado por email nos faltaba la resta.
Vamos a ver como poder implementar una resta, si bien veremos que el procedimiento es totalmente idéntico a los anteriores y [...]]]></description>
			<content:encoded><![CDATA[<p>Ya teníamos publicados un grupo de ejemplos que nos enseñaban a realizar algunas de las operaciones matemáticas básicas: <a href="http://lineadecodigo.com/java/sumar-dos-numeros-con-java/" title="sumar dos numeros con java">suma,</a> <a href="http://lineadecodigo.com/java/multiplicar-dos-numeros-con-java/" title="multiplicar dos numeros con java">multiplicación</a> y <a href="http://lineadecodigo.com/java/dividir-dos-numeros-con-java/" title="dividir dos numeros con java">división</a>. Si bien, como muchos nos habéis indicado por email nos faltaba la resta.</p>
<p>Vamos a ver como poder implementar una resta, si bien veremos que el procedimiento es totalmente idéntico a los anteriores y que solo cambiará la operación matemática en cuestión.</p>
<p>Lo primero que hacemos es crear una clase <a href="http://w3api.com/wiki/Java:Scanner" title="Scanner">Scanner</a> para pedir los datos al usuario</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;">Scanner reader = <span style="color: #000000; font-weight: bold;">new</span> Scanner<span style="color: #66cc66;">&#40;</span><a href="http://w3api.com/wiki/Java:System"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">in</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Acto seguido le pedimos los dos números a restar:</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;"><a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Introduce el primer número:&quot;</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;">numero1 = reader.<span style="color: #006600;">nextInt</span><span style="color: #66cc66;">&#40;</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;">&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;"><a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;Introduce el segundo número:&quot;</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;">numero2 = reader.<span style="color: #006600;">nextInt</span><span style="color: #66cc66;">&#40;</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;">&nbsp;</div></li></ol></pre>
<p>La lectura de lo que ha insertado el usuario la realizamos mediante el método <a href="http://w3api.com/wiki/Java:Scanner.nextInt()" title="nextInt()">nextInt()</a>. Ya que esperamos que el usuario haya insertado números por consola.</p>
<p>Ahora solo nos quedará ejecutar la resta:</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;">&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;">resultado = numero1-numero2;</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></ol></pre>
<p>Y mostrar nuestro resultado de la resta, por pantalla:</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;"><a href="http://w3api.com/wiki/Java:System"><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><span style="color: #ff0000;">&quot;La resta es &quot;</span> + numero1 + <span style="color: #ff0000;">&quot; - &quot;</span> + numero2 + <span style="color: #ff0000;">&quot; = &quot;</span> + resultado<span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/sumar-dos-numeros-con-java/" rel="bookmark" title="Enero 22, 2009">Sumar dos números con Java</a></li>
<li><a href="http://lineadecodigo.com/java/dividir-dos-numeros-con-java/" rel="bookmark" title="Junio 10, 2010">Dividir dos números con Java</a></li>
<li><a href="http://lineadecodigo.com/java/numeros-divisibles-con-java/" rel="bookmark" title="Julio 28, 2009">Números divisibles con Java</a></li>
<li><a href="http://lineadecodigo.com/java/ultimo-digito-de-un-numero-con-java/" rel="bookmark" title="Enero 11, 2009">Último dígito de un número con Java</a></li>
<li><a href="http://lineadecodigo.com/java/multiplicar-dos-numeros-con-java/" rel="bookmark" title="Diciembre 30, 2008">Multiplicar dos números con Java</a></li>
</ul>
<p><!-- Similar Posts took 2.740 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/I_04W5YrjtTVSwB2fvWyiK7a2Vg/0/da"><img src="http://feedads.g.doubleclick.net/~a/I_04W5YrjtTVSwB2fvWyiK7a2Vg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/I_04W5YrjtTVSwB2fvWyiK7a2Vg/1/da"><img src="http://feedads.g.doubleclick.net/~a/I_04W5YrjtTVSwB2fvWyiK7a2Vg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=AmSkWERQmc8:T3-CyNGGUIA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=AmSkWERQmc8:T3-CyNGGUIA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=AmSkWERQmc8:T3-CyNGGUIA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=AmSkWERQmc8:T3-CyNGGUIA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=AmSkWERQmc8:T3-CyNGGUIA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=AmSkWERQmc8:T3-CyNGGUIA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=AmSkWERQmc8:T3-CyNGGUIA:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/AmSkWERQmc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/restar-dos-numeros-con-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/restar-dos-numeros-con-java/</feedburner:origLink></item>
		<item>
		<title>Crear un objeto con métodos en Javascript</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/00xhmHJkWyA/</link>
		<comments>http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 06:00:59 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[atributo]]></category>
		<category><![CDATA[clase]]></category>
		<category><![CDATA[función]]></category>
		<category><![CDATA[función anónima]]></category>
		<category><![CDATA[función inline]]></category>
		<category><![CDATA[método]]></category>
		<category><![CDATA[objeto]]></category>
		<category><![CDATA[rectangulo]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2565</guid>
		<description><![CDATA[En el artículo de cómo crear un objeto en Javascript podíamos ver como construir de una forma muy sencilla una clase con atributos, de tal manera que instanciasemos objetos de dicha clase y accediésemos a sus atributos.
Ahora vamos a ver como podemos complicar la clase y añadirla métodos en Javascript.
En este caso vamos a utilzizar [...]]]></description>
			<content:encoded><![CDATA[<p>En el artículo de cómo <a href="http://lineadecodigo.com/javascript/crear-un-objeto-en-javascript/" title="crear un objeto en javascript">crear un objeto en Javascript</a> podíamos ver como construir de una forma muy sencilla una clase con atributos, de tal manera que instanciasemos objetos de dicha clase y accediésemos a sus atributos.</p>
<p>Ahora vamos a ver como podemos complicar la clase y añadirla métodos en <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a>.</p>
<p>En este caso vamos a utilzizar la clase Rectangulo, la cual tendrá dos atributos base y altura</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> rectangulo<span style="color: #66cc66;">&#40;</span>base,altura<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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">base</span> = base;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">altura</span> = altura;</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>
<p>Ahora añadimos el método que nos permita calcular el área del rectángulo. Para añadir un método podemos hacerlo de dos formas.</p>
<p>La primer será declarando una función <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a> inline. En este caso la función será anónima. Es decir, no tendá un nombre:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> rectangulo<span style="color: #66cc66;">&#40;</span>base,altura<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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">base</span> = base;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">altura</span> = altura;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">calcularArea</span> = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">base*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">altura</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;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>La segunda opción es asignar a una de las variables una función externa con nombre. Así, definimos la función getArea():</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> getArea<span style="color: #66cc66;">&#40;</span><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: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">base*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">altura</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>
<p>Y en la clase rectángulo asignamos a calcularArea, dicha función:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> rectangulo<span style="color: #66cc66;">&#40;</span>base,altura<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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">base</span> = base;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">altura</span> = altura;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">calcularArea</span> = getArea;</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>
<p>En ambos casos, instanciamos el objeto rectángulo:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">var</span> r1 = <span style="color: #003366; font-weight: bold;">new</span> rectangulo<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">2</span>,<span style="color: #CC0000;">4</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>y llamamos al método área:</p>
<pre class="javascript"><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: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>r1.<span style="color: #006600;">calcularArea</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/area-de-un-rectangulo-con-java/" rel="bookmark" title="Diciembre 13, 2007">Area de un rectángulo con Java</a></li>
<li><a href="http://lineadecodigo.com/svg/dibujar-un-rectangulo-con-svg/" rel="bookmark" title="Marzo 2, 2009">Dibujar un rectángulo con SVG</a></li>
<li><a href="http://lineadecodigo.com/javascript/crear-un-objeto-en-javascript/" rel="bookmark" title="Septiembre 1, 2010">Crear un objeto en Javascript</a></li>
<li><a href="http://lineadecodigo.com/svg/rectangulo-redondeado-en-svg/" rel="bookmark" title="Diciembre 24, 2007">Rectángulo redondeado en SVG</a></li>
<li><a href="http://lineadecodigo.com/javascript/validar-password-con-javascript/" rel="bookmark" title="Septiembre 1, 2009">Validar password con JavaScript</a></li>
</ul>
<p><!-- Similar Posts took 2.915 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/Pu07CqGGkRIet4PlAdyfv6xZ2Gs/0/da"><img src="http://feedads.g.doubleclick.net/~a/Pu07CqGGkRIet4PlAdyfv6xZ2Gs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Pu07CqGGkRIet4PlAdyfv6xZ2Gs/1/da"><img src="http://feedads.g.doubleclick.net/~a/Pu07CqGGkRIet4PlAdyfv6xZ2Gs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=00xhmHJkWyA:OddRhQHkBYI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=00xhmHJkWyA:OddRhQHkBYI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=00xhmHJkWyA:OddRhQHkBYI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=00xhmHJkWyA:OddRhQHkBYI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=00xhmHJkWyA:OddRhQHkBYI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=00xhmHJkWyA:OddRhQHkBYI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=00xhmHJkWyA:OddRhQHkBYI:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/00xhmHJkWyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/</feedburner:origLink></item>
		<item>
		<title>La historia no oficial sobre los Applets de Java</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/fBYRVsk_OVE/</link>
		<comments>http://lineadecodigo.com/lecturas/la-historia-no-oficial-sobre-los-applets-de-java/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 18:00:18 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Lecturas]]></category>
		<category><![CDATA[applet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[sun microsystems]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2612</guid>
		<description><![CDATA[Si estás al tanto de los últimos rifi rafes entre Google y Oracle por un "quítame allá esas patentes" te será interesante la lectura del artículo The unofficial history of Java applets (en inglés).
En el artículo, Yakov Fain, valora cuál será la estrategia de Java con  respecto al futuro de las plataformas RIA, añadiendo [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-2337" style="margin: 10px;" title="java_logo" src="http://lineadecodigo.com/wp-content/uploads/2010/04/java_logo.png" alt="" width="70" height="129" />Si estás al tanto de los últimos <a href="http://aulambra.lineadecodigo.com/novedades/programacion/google-se-baja-de-la-java-one-2010/" title="rifi rafes">rifi rafes entre Google y Oracle</a> por un "quítame allá esas patentes" te será interesante la lectura del artículo <a title="The unofficial history of Java applets" href="http://yakovfain.javadevelopersjournal.com/the_unofficial_history_of_java_applets.htm">The unofficial history of Java applets</a> <em>(en inglés)</em>.</p>
<p>En el artículo, Yakov Fain, valora cuál será la estrategia de Java con  respecto al futuro de las plataformas RIA, añadiendo una comparación de lo que le pasó a Sun Microsystems cuando se enfrentó legalmente a Microsoft y como le pasó factura en su evolución (principalmente en los <a href="http://www.manualweb.net/java/applets-en-java/" title="Applets en Java">Applets</a>) y lo que le puede pasar ahora a Oracle que se quiere enfrentar con Google por unas patentes y la plataforma Android.</p>
<p>Además comenta sobre ¿Por qué Oracle quiere volver a la etiqueta <a href="http://w3api.com/wiki/HTML:APPLET" title="applet">APPLET</a>?</p>
<p>¿Los temas legales pasarán nuevamente factura a la plataforma Java? ¿Saldrá perjudicada en la pelea por el pastel de las plataformas RIA?</p>
<p>Leer <a title="The unofficial history of Java applets" href="http://yakovfain.javadevelopersjournal.com/the_unofficial_history_of_java_applets.htm">The unofficial history of Java applets</a> <em>(en inglés)</em><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/java-ee-5-sdk-update-2/" rel="bookmark" title="Diciembre 15, 2006">Java EE 5 SDK Update 2</a></li>
<li><a href="http://lineadecodigo.com/noticias-web/ajax-en-la-plataforma-ibm-websphere/" rel="bookmark" title="Enero 23, 2007">AJAX en la Plataforma IBM WebSphere</a></li>
<li><a href="http://lineadecodigo.com/noticias-web/silverlight-10/" rel="bookmark" title="Septiembre 8, 2007">SilverLight 1.0</a></li>
<li><a href="http://lineadecodigo.com/download/descargas-octubre-09/" rel="bookmark" title="Octubre 1, 2009">Descargas Octubre.09</a></li>
<li><a href="http://lineadecodigo.com/java/javalangunsupportedclassversionerror/" rel="bookmark" title="Enero 28, 2007">java.lang.UnsupportedClassVersionError</a></li>
</ul>
<p><!-- Similar Posts took 3.027 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/i08N4bqxt883YP5sDBw_QV8n_Fc/0/da"><img src="http://feedads.g.doubleclick.net/~a/i08N4bqxt883YP5sDBw_QV8n_Fc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/i08N4bqxt883YP5sDBw_QV8n_Fc/1/da"><img src="http://feedads.g.doubleclick.net/~a/i08N4bqxt883YP5sDBw_QV8n_Fc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=fBYRVsk_OVE:8kt7ouVtarE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=fBYRVsk_OVE:8kt7ouVtarE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=fBYRVsk_OVE:8kt7ouVtarE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=fBYRVsk_OVE:8kt7ouVtarE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=fBYRVsk_OVE:8kt7ouVtarE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=fBYRVsk_OVE:8kt7ouVtarE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=fBYRVsk_OVE:8kt7ouVtarE:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/fBYRVsk_OVE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/lecturas/la-historia-no-oficial-sobre-los-applets-de-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/lecturas/la-historia-no-oficial-sobre-los-applets-de-java/</feedburner:origLink></item>
		<item>
		<title>Conocer el tipo de una variable en VBScript</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/-MP8IMYMqpI/</link>
		<comments>http://lineadecodigo.com/vbscript/conocer-el-tipo-de-una-variable-en-vbscript/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 06:00:46 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[boolean]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[currency]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[Double]]></category>
		<category><![CDATA[empty()]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Integer]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[OBJECT]]></category>
		<category><![CDATA[single]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[variant]]></category>
		<category><![CDATA[vartype]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2551</guid>
		<description><![CDATA[Las variables en VBScript no tienen un tipo por defecto, si no que pasan a ser de un tipo en el momento en el cuál las asignamos un valor.
Así, si tenemos el código
dim x
x será de tipo "sin inicializar". Si ahora le asignamos un valor, por ejemplo una cadena de texto:
x = &#34;Hola Mundo&#34;
x pasará [...]]]></description>
			<content:encoded><![CDATA[<p>Las variables en <a href=" http://www.manualweb.net/tutorial-vbscript/" title="VBScript">VBScript</a> no tienen un tipo por defecto, si no que pasan a ser de un tipo en el momento en el cuál las asignamos un valor.</p>
<p>Así, si tenemos el código</p>
<pre><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;">dim x</div></li></ol></pre>
<p>x será de tipo "sin inicializar". Si ahora le asignamos un valor, por ejemplo una cadena de texto:</p>
<pre><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;">x = &quot;Hola Mundo&quot;</div></li></ol></pre>
<p>x pasará a ser del tipo cadena.</p>
<p>Si queremos saber el tipo de una variable en <a href=" http://www.manualweb.net/tutorial-vbscript/" title="VBScript">VBScript</a> podemos apoyarnos en la función <a href="http://w3api.com/wiki/VBScript:VarType" title=" VarType">VarType</a>, a la cual le pasamos la variable como parámetro.</p>
<pre><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;">x = &quot;Hola Mundo&quot;</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;">document.write(&quot;La variable es de tipo &quot; &amp; VarType(x))</div></li></ol></pre>
<p>La función <a href="http://w3api.com/wiki/VBScript:VarType" title=" VarType">VarType</a> devolverá un valor entero que representará un tipo de variable. Los valores enteros corresponden a lo siguiente:</p>
<ul>
<li>0-Null</li>
<li>1-Empty</li>
<li>2 -Integer</li>
<li>3-Long</li>
<li>4-Single</li>
<li>5-Double</li>
<li>6-Currency</li>
<li>7-Date</li>
<li>8-String</li>
<li>9-Objeto de automatización</li>
<li>10-Error</li>
<li>11-Boolean</li>
<li>12-Variant</li>
<li>13-Objeto de acceso a datos</li>
<li>17-Byte</li>
<li>8192-Array</li>
</ul>
<p>Así, que si queremos mostrar por pantalla el tipo de la variable y no su código, podemos utilizar una <a href="http://www.manualweb.net/vbscript/estructuras-selectivas/#toc-case" title="estructura del tipo case">estructura del tipo case</a> de la siguiente forma:</p>
<pre><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;">&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;">select case VarType(variable)</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;">case 0</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;">  document.write(&quot;sin inicializar&quot;)</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;">case 1</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;">  document.write(&quot;null&quot;)</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;">case 2</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;">  document.write(&quot;integer&quot;)</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;">case 3</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;">  document.write(&quot;long&quot;)</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;">case 4</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;">  document.write(&quot;single&quot;)</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;">case 5</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;">  document.write(&quot;double&quot;)</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;">case 6</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;">  document.write(&quot;currency&quot;)</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;">case 7</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;">  document.write(&quot;date&quot;)</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;">case 8</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;">  document.write(&quot;string&quot;)</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;">case 9</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;">  document.write(&quot;object&quot;)</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;">case 10</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;">  document.write(&quot;error&quot;)</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;">case 11</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;">  document.write(&quot;boolean&quot;)</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;">case 12</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;">  document.write(&quot;variant&quot;)</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;">case 13</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;">  document.write(&quot;dataobject&quot;)</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;">case 17</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;">  document.write(&quot;byte&quot;)</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;">case 8192</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;">  document.write(&quot;array&quot;)</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;">case else</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;">  document.write (&quot;no contemplada&quot;)</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;">end select</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></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/vbscript/fecha-en-castellano-con-vbscript/" rel="bookmark" title="Enero 18, 2007">Fecha en castellano con VBScript</a></li>
<li><a href="http://lineadecodigo.com/vbscript/definir-una-variable-en-vbscript/" rel="bookmark" title="Septiembre 7, 2010">Definir una variable en VBScript</a></li>
<li><a href="http://lineadecodigo.com/javascript/escapar-caracteres-en-javascript/" rel="bookmark" title="Septiembre 15, 2009">Escapar caracteres en JavaScript</a></li>
<li><a href="http://lineadecodigo.com/asp/localizacion-en-asp/" rel="bookmark" title="Abril 18, 2010">Localización en ASP</a></li>
<li><a href="http://lineadecodigo.com/vbscript/como-definir-una-constante-en-vbscript/" rel="bookmark" title="Mayo 28, 2010">Cómo definir una constante en VBScript</a></li>
</ul>
<p><!-- Similar Posts took 7.148 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/OkJ170tldTONcG01YSIk0Xw72Ls/0/da"><img src="http://feedads.g.doubleclick.net/~a/OkJ170tldTONcG01YSIk0Xw72Ls/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OkJ170tldTONcG01YSIk0Xw72Ls/1/da"><img src="http://feedads.g.doubleclick.net/~a/OkJ170tldTONcG01YSIk0Xw72Ls/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=-MP8IMYMqpI:azav6aAzSQY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=-MP8IMYMqpI:azav6aAzSQY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=-MP8IMYMqpI:azav6aAzSQY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=-MP8IMYMqpI:azav6aAzSQY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=-MP8IMYMqpI:azav6aAzSQY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=-MP8IMYMqpI:azav6aAzSQY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=-MP8IMYMqpI:azav6aAzSQY:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/-MP8IMYMqpI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/vbscript/conocer-el-tipo-de-una-variable-en-vbscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/vbscript/conocer-el-tipo-de-una-variable-en-vbscript/</feedburner:origLink></item>
		<item>
		<title>La W3C crea el Web Performance Working Group</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/TZI0uWeywnM/</link>
		<comments>http://lineadecodigo.com/noticias-web/la-w3c-crea-el-web-performance-working-group/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 18:00:36 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Noticias Web]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[rendimiento]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[webapps]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2585</guid>
		<description><![CDATA[La W3C ha decidido crear el grupo Web Performance Working Group con el fin de estandarizar la forma de medir el rendimiento de los agentes de usuario.
Esto viene derivado del creciente desarrollo de aplicaciones más sofisticadas, con funcionalidades RIA y APIs de diferente índole. Con el fin de poder establecer una serie de métodos que [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lineadecodigo.com/wp-content/uploads/2006/12/w3c.jpg"><img src="http://lineadecodigo.com/wp-content/uploads/2006/12/w3c.jpg" alt="" title="W3C" width="73" height="90" class="alignright size-full wp-image-231" /></a>La <a href="http://www.w3.org" title="W3C">W3C</a> ha decidido crear el grupo <a href="http://www.w3.org/2010/webperf/" title="Web Performance Working Group">Web Performance Working Group</a> con el fin de estandarizar la forma de medir el rendimiento de los agentes de usuario.</p>
<p>Esto viene derivado del creciente desarrollo de aplicaciones más sofisticadas, con funcionalidades RIA y APIs de diferente índole. Con el fin de poder establecer una serie de métodos que faciliten el análisis del rendimiento.</p>
<p>Este nuevo grupo estará alineado con las tecnologías que rodean la <a href="http://www.w3.org" title="W3C">W3C</a> como <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTM</a>L, <a href="http://www.manualweb.net/tutorial-svg/" title="SVG">SVG</a>, <a href="http://www.manualweb.net/tutorial-css/" title="CSS">CSS</a>, WebApps,...</p>
<p><a href="http://www.w3.org/News/2010#entry-8879" title="Noticia de la creación del Web Performance Working Group en W3C">Leer la noticia en W3C...</a><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/eventos/bea-world-2007/" rel="bookmark" title="Septiembre 18, 2007">BEA World 2007</a></li>
<li><a href="http://lineadecodigo.com/noticias-web/se-lanza-firefox-30-alpha-1/" rel="bookmark" title="Diciembre 14, 2006">Se lanza FireFox 3.0 alpha 1</a></li>
<li><a href="http://lineadecodigo.com/noticias-web/driver-jdbc-type-5/" rel="bookmark" title="Abril 30, 2010">Driver JDBC Type 5</a></li>
<li><a href="http://lineadecodigo.com/java/liberado-java-se-6/" rel="bookmark" title="Diciembre 17, 2006">Liberado Java SE 6</a></li>
<li><a href="http://lineadecodigo.com/eventos/on-air-tour/" rel="bookmark" title="Marzo 26, 2008">on AIR Tour</a></li>
</ul>
<p><!-- Similar Posts took 4.096 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/_JdYmcYVCETlFp7wy6CDSDj5N-U/0/da"><img src="http://feedads.g.doubleclick.net/~a/_JdYmcYVCETlFp7wy6CDSDj5N-U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/_JdYmcYVCETlFp7wy6CDSDj5N-U/1/da"><img src="http://feedads.g.doubleclick.net/~a/_JdYmcYVCETlFp7wy6CDSDj5N-U/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=TZI0uWeywnM:jfTIKDuhxZE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=TZI0uWeywnM:jfTIKDuhxZE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=TZI0uWeywnM:jfTIKDuhxZE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=TZI0uWeywnM:jfTIKDuhxZE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=TZI0uWeywnM:jfTIKDuhxZE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=TZI0uWeywnM:jfTIKDuhxZE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=TZI0uWeywnM:jfTIKDuhxZE:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/TZI0uWeywnM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/noticias-web/la-w3c-crea-el-web-performance-working-group/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/noticias-web/la-w3c-crea-el-web-performance-working-group/</feedburner:origLink></item>
		<item>
		<title>Crear un objeto en Javascript</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/wCuQfSEEY-U/</link>
		<comments>http://lineadecodigo.com/javascript/crear-un-objeto-en-javascript/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 06:00:40 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[atributos]]></category>
		<category><![CDATA[clase]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[objeto]]></category>
		<category><![CDATA[persona]]></category>
		<category><![CDATA[poo]]></category>
		<category><![CDATA[propiedad]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2557</guid>
		<description><![CDATA[Aunque Javascript no es un lenguaje orientado a objetos, por lo menos en sus versiones 1.x, podemos crear objetos y gestionar nuestro código mediantes estos mismos. 
Como recordatorio de la programación orientada a objetos, hay que tener en cuenta que la clase es la definición y los objetos son las instancias individuales de la clase, [...]]]></description>
			<content:encoded><![CDATA[<p>Aunque <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a> no es un lenguaje orientado a objetos, por lo menos en sus versiones 1.x, podemos crear objetos y gestionar nuestro código mediantes estos mismos. </p>
<blockquote><p>Como recordatorio de la programación orientada a objetos, hay que tener en cuenta que la clase es la definición y los objetos son las instancias individuales de la clase, con valores determinados</p></blockquote>
<p>En <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a> las clases se crean utilizando las funciones. Es por ello que, si queremos crear una clase, lo único que tenemos que hacer es crear una función.</p>
<p>Por ejemplo, si queremos crear la clase Persona que contenga los atributos nombre, apellidos y edad lo haremos de la siguiente forma:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">function</span> persona<span style="color: #66cc66;">&#40;</span>nombre,apellido,edad<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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">nombre</span> = nombre;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">apellido</span> = apellido;</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">edad</span> = edad;</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>
<p>Los atributos que crearemos dentro de la clase se referencian mediante this. Lo que hacemos es asignarlos los valores que se le pasan a la función.</p>
<p>Para instanciar un objeto de una clase utilizaremos la sentencia new. Así si queremos instanciar un objeto de la clase Persona tendremos la siguiente línea de código:</p>
<pre class="javascript"><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: #003366; font-weight: bold;">var</span> persona1 = <span style="color: #003366; font-weight: bold;">new</span> Persona<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Victor&quot;</span>,<span style="color: #3366CC;">&quot;Cuervo&quot;</span>,<span style="color: #CC0000;">32</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Ahora lo que haremos será utilizar la información que hay dentro del objeto. Así, si queremos acceder a una propiedad utilizaremos la estructura:</p>
<pre class="javascript"><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;">objeto.<span style="color: #006600;">propiedad</span></div></li></ol></pre>
<p>Para sacar un mensaje con el nombre de una Persona tendremos el siguiente código:</p>
<pre class="javascript"><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: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>persona1.<span style="color: #006600;">nombre</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Como podemos ver crear una clase e instanciar un objeto de la misma en <a href="http://www.manualweb.net/tutorial-javascript/" title="Javascript">Javascript</a> se hace de una forma rápida y sencilla.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/html/generar-un-documento-html-mediante-javascript/" rel="bookmark" title="Junio 28, 2007">Generar un documento HTML mediante JavaScript</a></li>
<li><a href="http://lineadecodigo.com/prototype/obtener-elemento-de-un-formulario-con-prototype/" rel="bookmark" title="Febrero 10, 2007">Obtener elemento de un formulario con Prototype</a></li>
<li><a href="http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/" rel="bookmark" title="Septiembre 3, 2010">Crear un objeto con métodos en Javascript</a></li>
<li><a href="http://lineadecodigo.com/javascript/hacer-foco-en-un-campo-de-la-pagina-usando-javascript/" rel="bookmark" title="Junio 13, 2007">Hacer foco en un campo de la página usando JavaScript</a></li>
<li><a href="http://lineadecodigo.com/asp/mandar-emails-con-aspemail/" rel="bookmark" title="Marzo 11, 2009">Mandar emails con ASPEmail</a></li>
</ul>
<p><!-- Similar Posts took 3.300 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/WmB6k1X1LrlAKIaMJ9YxjI5yNGk/0/da"><img src="http://feedads.g.doubleclick.net/~a/WmB6k1X1LrlAKIaMJ9YxjI5yNGk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WmB6k1X1LrlAKIaMJ9YxjI5yNGk/1/da"><img src="http://feedads.g.doubleclick.net/~a/WmB6k1X1LrlAKIaMJ9YxjI5yNGk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=wCuQfSEEY-U:kq2F2nkAiRk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=wCuQfSEEY-U:kq2F2nkAiRk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=wCuQfSEEY-U:kq2F2nkAiRk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=wCuQfSEEY-U:kq2F2nkAiRk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=wCuQfSEEY-U:kq2F2nkAiRk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=wCuQfSEEY-U:kq2F2nkAiRk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=wCuQfSEEY-U:kq2F2nkAiRk:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/wCuQfSEEY-U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/javascript/crear-un-objeto-en-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/javascript/crear-un-objeto-en-javascript/</feedburner:origLink></item>
		<item>
		<title>Vaciar el contenido de un fichero mediante borrado y creación</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/X9KJrfLgivE/</link>
		<comments>http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-mediante-borrado-y-creacion/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 06:00:04 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[contenido]]></category>
		<category><![CDATA[createNewFile]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[IOException]]></category>
		<category><![CDATA[vaciar]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2545</guid>
		<description><![CDATA[Si ayer veíamos como Vaciar el contenido de un fichero con Java. Hoy vamos a proponer otra alternativa a lo explicado en dicho artículo.
En este caso el procedimiento para vaciar el contenido de un fichero con Java será el de borrar el fichero y volverlo a crear. Un procedimiento mucho más brusco que el anterior. [...]]]></description>
			<content:encoded><![CDATA[<p>Si ayer veíamos como <a href="http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-con-java/" title="Vaciar el contenido de un fichero con Java">Vaciar el contenido de un fichero con Java</a>. Hoy vamos a proponer otra alternativa a lo explicado en dicho artículo.</p>
<p>En este caso el procedimiento para vaciar el contenido de un fichero con Java será el de borrar el fichero y volverlo a crear. Un procedimiento mucho más brusco que el anterior. <img src='http://lineadecodigo.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Hay que tener especial cuidado ya que en ciertos entornos podemos manipular el contenido de un fichero, si bien no tenemos capacidades de borrado y creación de los mismos. Es por ello que este código no valdría. De igual manera es brusco, ya que el proceso podría realizar solo uno de los dos pasos -el borrado- y dejar incosistente el sistema. Es por ello que seguimos recomendando lo explicado en <a href="http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-con-java/" title="Vaciar el contenido de un fichero con Java">Vaciar el contenido de un fichero con Java</a>.</p>
<p>Si bien, vamos con ello... Con la clase <a href="http://w3api.com/wiki/Java:File" title="File">File</a> obtenemos una instancia del fichero que queremos manipular</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;"><a href="http://w3api.com/wiki/Java:String"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sFichero = <span style="color: #ff0000;">&quot;fichero1.txt&quot;</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://w3api.com/wiki/Java:File"><span style="color: #aaaadd; font-weight: bold;">File</span></a> f = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://w3api.com/wiki/Java:File"><span style="color: #aaaadd; font-weight: bold;">File</span></a><span style="color: #66cc66;">&#40;</span>sFichero<span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Ahora solo tenemos que enviar los dos comandos: el de borrado mediante el método <a href="http://w3api.com/wiki/Java:File.delete()">.delete()</a> y el de creación mediante el método <a href="http://w3api.com/wiki/Java:File.createNewFile()" title="createNewFile()">.createNewFile()</a></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;">f.<span style="color: #006600;">delete</span><span style="color: #66cc66;">&#40;</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: #000000; font-weight: bold;">try</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;">  f.<span style="color: #006600;">createNewFile</span><span style="color: #66cc66;">&#40;</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> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://w3api.com/wiki/Java:IOException"><span style="color: #aaaadd; font-weight: bold;">IOException</span></a> ioe<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;">  ioe.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</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>
<p>Cuando lanzamos el método <a href="http://w3api.com/wiki/Java:File.createNewFile()" title="createNewFile()">.createNewFile()</a> hay que tener cuidado ya que se puede elevar la excepción <a href="http://w3api.com/wiki/Java:IOException" title="IOException">IOException</a>.</p>
<p>Ya hemos visto que con unas pocas líneas podemos vaciar el contenido de un fichero mediante borrado y creación.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-con-java/" rel="bookmark" title="Julio 31, 2010">Vaciar el contenido de un fichero con Java</a></li>
<li><a href="http://lineadecodigo.com/java/borrar-un-fichero-con-java/" rel="bookmark" title="Febrero 26, 2008">Borrar un fichero con Java</a></li>
<li><a href="http://lineadecodigo.com/java/crear-un-fichero-en-java/" rel="bookmark" title="Julio 21, 2007">Crear un fichero en Java</a></li>
<li><a href="http://lineadecodigo.com/java/conocer-el-tamano-de-un-fichero-con-java/" rel="bookmark" title="Julio 7, 2007">Conocer el tamaño de un fichero con Java</a></li>
<li><a href="http://lineadecodigo.com/asp/borrar-un-fichero-con-asp/" rel="bookmark" title="Enero 25, 2009">Borrar un fichero con ASP</a></li>
</ul>
<p><!-- Similar Posts took 2.918 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/8prYq4KFt0iMmU_0EJRp4XbJEOY/0/da"><img src="http://feedads.g.doubleclick.net/~a/8prYq4KFt0iMmU_0EJRp4XbJEOY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8prYq4KFt0iMmU_0EJRp4XbJEOY/1/da"><img src="http://feedads.g.doubleclick.net/~a/8prYq4KFt0iMmU_0EJRp4XbJEOY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=X9KJrfLgivE:jDG-qtNjax4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=X9KJrfLgivE:jDG-qtNjax4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=X9KJrfLgivE:jDG-qtNjax4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=X9KJrfLgivE:jDG-qtNjax4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=X9KJrfLgivE:jDG-qtNjax4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=X9KJrfLgivE:jDG-qtNjax4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=X9KJrfLgivE:jDG-qtNjax4:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/X9KJrfLgivE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-mediante-borrado-y-creacion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-mediante-borrado-y-creacion/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.478 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-09-07 08:01:33 -->
