Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package clases_y_objetos;
- /**
- *
- * @author JUAN
- */
- public class Persona {
- String nombre;
- String telefono;
- int edad;
- public Persona (String nom, String tel, int edad){
- this.nombre = nom;
- this.telefono = tel;
- this.edad = edad;
- }
- public void mostrarPersona(){
- System.out.println("Persona creada: \n"+
- "Nombre: "+this.nombre+
- ", Telefono: "+this.telefono+
- ", Edad: "+this.edad);
- }
- }
- //----------------------------------------------------------------------------------------------------------------------------
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package clases_y_objetos;
- /**
- *
- * @author JUAN
- */
- public class Agenda {
- public static void main(String[] args) {
- //se crean las personas
- Persona personaUno = new Persona("Pablo Ruiz Montes", "1234567890", 43);
- Persona personaDos = new Persona("fabiola Rios castro", "0987654321", 23);
- //Se muestran las personas
- personaUno.mostrarPersona();
- personaDos.mostrarPersona();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement