Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jhaymayleth/unidad2_java/llms.txt

Use this file to discover all available pages before exploring further.

Taller 7 introduces access modifiers — the mechanism Java uses to control which parts of your code can access class members. Starting from a simple employee model with mixed public and private fields, the exercises progress through a fully encapsulated bank account and conclude with a stateless utility class whose methods never require an object instance.

Exercises

Ejercicio 1 — Empleado

Explore public vs private fields, the getter/setter pattern, and salary validation logic in a concrete employee model.

Ejercicio 2 — CuentaBancaria

Protect sensitive financial data with private fields, validated deposit and withdrawal methods, and peer-to-peer transfers.

Ejercicio 3 — Utilidades

Build a static utility class whose arithmetic, rounding, prime-checking, and factorial methods need no instantiation.

Key Concepts Covered

ConceptDescription
publicMembers accessible from any class
privateMembers accessible only within the declaring class
Getter / Setter patternControlled read and write access to private fields
Input validationSetters and operation methods reject invalid data before mutating state
static methodsUtility methods that belong to the class, not to any instance

Compiling the Exercises

Run the following commands from the repository root to compile each exercise independently:
# Ejercicio 1 — Empleado
javac Taller7/ejercicio_1/Empleado.java Taller7/ejercicio_1/PruebaEjercicio1.java

# Ejercicio 2 — CuentaBancaria
javac Taller7/ejercicio_2/CuentaBancaria.java Taller7/ejercicio_2/PruebaEjercicio2.java

# Ejercicio 3 — Utilidades
javac Taller7/ejercicio_3/Utilidades.java Taller7/ejercicio_3/PruebaEjercicio3.java

Build docs developers (and LLMs) love