Advertisement
bigLiukTheory

Persona.java

Jun 25th, 2013
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class Persona
  2. {
  3.     //PARAMETRI DELLA CLASSE
  4.     String nome;
  5.     String cognome;
  6.     char sesso; //m o f
  7.    
  8.     //COSTRUTTORE
  9.     public Persona(String unNome, String unCognome, char unSesso)
  10.     {
  11.         nome = unNome;
  12.         cognome = unCognome;
  13.         sesso = unSesso;
  14.     }
  15.    
  16.     //METODI
  17.     public void stampaPersona()
  18.     {
  19.         System.out.println("Persona: " + nome + " " + cognome + " di sesso " + sesso);
  20.     }
  21.    
  22.     public int contaCaratteriNome()
  23.     {
  24.         int caratteri = nome.length();
  25.         return caratteri;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement