Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class Persona{
- private int edad;
- public String nombre;
- public String genero;
- public int vida;
- public void hable(){
- System.out.println("hola estoi hablando y soy"
- +nombre);
- }
- private void escuche(){
- System.out.println("escucho.. y soy "+nombre);
- Scanner scanf = new Scanner(System.in);
- int captura = scanf.nextInt();
- System.out.println("Yo escuche esto: "+captura);
- }
- public void respirar(){
- vida++;
- System.out.println("I'm "+nombre+ " :3 tengo "+vida);
- }
- public static void main(String[] args){
- Persona uno = new Persona();
- Persona dos = new Persona();
- dos.nombre = "juan";
- uno.nombre = "adrian";
- dos.edad = 15;
- dos.vida = 100;
- uno.hable();
- dos.respirar();
- uno.escuche();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement