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
class Persona { | |
String nombre; | |
Persona(String nombre) { | |
this.nombre = nombre; | |
} | |
void saludar() { | |
System.out.println("Hola, soy " + nombre); | |
} |
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.util.Scanner; | |
class Animal { // super clase o clase padre | |
String nombre; | |
int edad; | |
// Constructor de Animal | |
public Animal(String nombre, int edad) { | |
this.nombre = nombre; | |
this.edad = edad; |
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.util.Scanner; | |
class Animal {//super clase o clase padre | |
public void comer() { //Todos los metodos son publicos | |
System.out.println("Este animal come"); | |
} | |
public void dormir() {//Todos los metodos son publicos | |
System.out.println("Este animal duerme"); | |
} | |
public void jugar() {//Todos los metodos son publicos |
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
class Animal {//super clase o clase padre | |
public void comer() { //Todos los metodos son publicos | |
System.out.println("Este animal come"); | |
} | |
public void dormir() {//Todos los metodos son publicos | |
System.out.println("Este animal duerme"); | |
} | |
public void jugar() {//Todos los metodos son publicos | |
System.out.println("Este animal duerme"); |
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
var a=122; | |
var b=22; | |
var c=3; | |
if (a>b) | |
{ | |
console.log("A es mayor") | |
}else{ | |
console.log("B es mayor") | |
} |