This file contains 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.util.concurrent.Semaphore; | |
public class Semaforo { | |
public static void main(String[] args) { | |
// Crear un semáforo con 3 permisos | |
Semaphore semaforo = new Semaphore(3); | |
// Crear una tarea que use el recurso compartido | |
Runnable tarea = () -> { | |
String nombreHilo = Thread.currentThread().getName(); |
This file contains 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
package pack; | |
import java.util.Scanner; | |
public class Inverter { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Escribe una cadena de texto: "); |
This file contains 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
package bucle; | |
import java.util.Scanner; | |
public class Mcd { | |
public static void main(String[] args) { | |
var sc = new Scanner(System.in); | |
System.out.println("Cálculo del Máximo Común Divisor."); |
This file contains 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
package bucle; | |
import java.util.Scanner; | |
public class Table { | |
public static void main(String[] args) { | |
var sc = new Scanner(System.in); | |
System.out.print("¿Qué tabla de multiplicar necesitas (1-10): "); |
This file contains 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
package bucle; | |
import java.util.Scanner; | |
public class Switch { | |
public static void main(String[] args) { | |
var sc = new Scanner(System.in); | |
System.out.print("Nota del Alumno: "); |
This file contains 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
package control; | |
import java.util.Scanner; | |
public class Switch { | |
public static void main(String[] args) { | |
var sc = new Scanner(System.in); |
This file contains 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
<!DOCTYPE html> | |
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Disable Right Click</title> | |
</head> | |
<body> | |
<h1>Example of disabling the right button</h1> | |
<p>Try right-clicking anywhere on this page.</p> |