Advertisement
Guest User

poopoo

a guest
Jan 28th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. public class Estu {
  2.  
  3.   private String nombre;
  4.   private int cal;
  5.  
  6.   public String getNombre() {
  7.   return this.nombre;
  8.   }
  9.  
  10.   public int getCal() {
  11.   return this.cal;
  12.   }
  13.  
  14.   public void setNombre(String nombre) {
  15.   this.nombre = nombre;
  16.   }
  17.  
  18.   public void setCal(int cal) {
  19.   this.cal = cal;
  20.   }
  21.  
  22.   public static void main(String[] args) {
  23.   Estu est1 = new Estu();
  24.   Estu est2 = new Estu();
  25.   est1.setNombre("Juan");
  26.   est1.setCal(6);
  27.  
  28.   est2.setNombre("Benjamin");
  29.   est2.setCal(8);
  30.   System.out.println(est1.getNombre() + ", " +
  31.     est2.getNombre());
  32.   }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement