Skip to content

Instantly share code, notes, and snippets.

@tedyblood
Created September 4, 2013 19:58
Show Gist options
  • Save tedyblood/6442075 to your computer and use it in GitHub Desktop.
Save tedyblood/6442075 to your computer and use it in GitHub Desktop.
// Ejemplo "Hola Mundo" en Java // Programa fuente: Greeting.java
//
// Ejemplo "Hola Mundo"
// Programa fuente: Greeting.java
//
// Declaraci?n de la clase Greeting.
public class Greeting {
private String salutation;
// M?todo constructor Greeting( )
Greeting ( String s ) {
salutation = s ;
}
// M?todo greet( String whom )
public void greet( String whom ){
System.out.println( salutation + " " + whom);
}
}
//
// Ejemplo "Hola Mundo"
// Programa fuente: TestGreeting.java
public class TestGreeting{
public static void main ( String [] args){
Greeting hello = new Greeting("Hola");
hello.greet("Mundo");
}
}
//
// Ejemplo "Hola Mundo"
// Programa fuente: TestGreeting.java
public class TestGreeting2{
public static void main ( String [] args){
Greeting hello = new Greeting("Hola");
hello.greet("Mundo");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment