• This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

Uso de parámetros en aplicaciones java

Como estaran acostumbrados en windows hay programas de consola a los cuales se les pasa parametros o argumentos para configurar.
ejemplo:
Programa_java parametro1 parametro2
Estos argumentos entran a un arreglo de cadenas que se llama String args[] y que es el parámetro del método main.

args.length=2
args[0]=parametro1
args[1]=parametro2

Si la pasamos a codigo java.
public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("Este programa tiene " + args.length + " argumentos");
    int i;
    for ( i=0; i
{
System.out.println("Elemento "+arg[i]);
}


De esta manera le podemos pasar los parámetros a los programas que creemos y así evitarnos molestos menús de configuración innecesarios, ademas de ser eficaz en caso trabajemos solo en modo consola.
Share:

Visitantes

Flag Counter

Popular Posts

Etiquetas

Recent Posts