This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Ejemplo Singleton | |
* | |
* Este ejemplo muestra cómo desde main() se usa el objeto singleton, | |
* y doSomething() obtiene por su cuenta el mismo objeto | |
* sin necesidad de que se le envíe por parámetro ni App guarde una | |
* referencia al objeto. | |
* | |
* Es una buena forma de asegurarse que únicamente existe una instancia | |
* de la clase Singleton en toda la aplicación. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile: javac -d . *.java | |
// Execute: java mvcpatterndemo.MVCPatternDemo | |
package mvcpatterndemo; | |
public class MVCPatternDemo { | |
public static void main(String[] args) { | |
//fetch student record based on his roll no from the database | |
Student model = retriveStudentFromDatabase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Uso: ./remotos.sh | |
# | |
# Uso: ./remotos.sh -f | |
# La opción -f fuerza a borrar los directorios | |
# de los repositorios si ya existen | |
# | |
set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Uso: ./project-manual.sh | |
# Crea un repositorio y realiza commits | |
# | |
# Uso: ./project-manual.sh -f | |
# La opción -f fuerza a borrar el directorio | |
# del repositorio si ya existe | |
# | |
set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#============== Punto 1 | |
#============== Inicia un repositorio con tres commits | |
$ git init | |
# Create README.md | |
$ git add -A | |
$ git commit -m "Primer commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git init | |
# Creo main.java | |
$ git add main.java | |
$ git commit -m "Add main.java" | |
# Modifico en main.java | |
# Uso git add -A para añadir todos los cambios de |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class LectorFicheros { | |
public static void lee(String filename) throws IOException { | |
System.out.println("Leyendo " + filename + ":"); | |
System.out.println(); | |
InputStream in = LectorFicheros.class.getResourceAsStream(filename); | |
try (BufferedReader br = new BufferedReader( new InputStreamReader(in) )) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PrimeraClase { | |
public static void main(String[] args) { | |
System.out.println("Primera clase main"); | |
SegundaClase x = new SegundaClase(); | |
x.hacerAlgo(); | |
} | |
} |