Advertisement
everblut

Persona

Jan 17th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class Persona{
  5.  
  6.     private int edad;
  7.     public String nombre;
  8.     public String genero;
  9.     public int vida;
  10.  
  11.     public void hable(){
  12.         System.out.println("hola estoi hablando y soy"
  13.                +nombre);
  14.     }
  15.  
  16.     private void escuche(){
  17.     System.out.println("escucho.. y soy "+nombre);
  18.     Scanner  scanf  = new Scanner(System.in);
  19.     int captura = scanf.nextInt();
  20.     System.out.println("Yo escuche esto: "+captura);
  21.     }
  22.  
  23.     abstract void caminar();
  24.  
  25.     public void respirar(){
  26.     vida++;
  27.     System.out.println("I'm "+nombre+ " :3 tengo "+vida);
  28.     }
  29.  
  30.     public static void main(String[] args){
  31.     Persona uno = new Persona();
  32.     Persona dos = new Persona();
  33.    
  34.     dos.nombre = "juan";
  35.     uno.nombre = "adrian";
  36.  
  37.     dos.edad = 15;
  38.     dos.vida = 100;
  39.  
  40.     uno.hable();
  41.    
  42.     dos.respirar();
  43.  
  44.     uno.escuche();
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement