feat(ch 5): example & ex added

This commit is contained in:
Rafa Muñoz
2024-12-03 09:37:36 +01:00
parent 38fe9675d3
commit 6d5b6d56d5
13 changed files with 517 additions and 3 deletions

View File

@@ -23,7 +23,6 @@ public class Ejercicio02_findAndReplace {
* @return
*/
public static void findAndReplace (int b[], int buscado, int reemplazo) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
if (b[i] == buscado) {

View File

@@ -4,13 +4,14 @@ public class Ejercicio04_MatrizConBordeYCeroAlAzar {
public static void main(String[] args) {
// Declaración de variables
char matriz[][] = new char[20][10];
char matriz[][] = new char[10][20];
int posicionAzarFila, posicionAzarColumna;
// La relleno de espacios en blanco
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (i == 0 || i == (matriz.length - 1) || j == 0 || j == (matriz[0].length - 1)) {
if (i == 0 || i == (matriz.length - 1) ||
j == 0 || j == (matriz[0].length - 1)) {
matriz[i][j] = '*';
}
else {