Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Persona
- {
- //PARAMETRI DELLA CLASSE
- String nome;
- String cognome;
- char sesso; //m o f
- //COSTRUTTORE
- public Persona(String unNome, String unCognome, char unSesso)
- {
- nome = unNome;
- cognome = unCognome;
- sesso = unSesso;
- }
- //METODI
- public void stampaPersona()
- {
- System.out.println("Persona: " + nome + " " + cognome + " di sesso " + sesso);
- }
- public int contaCaratteriNome()
- {
- int caratteri = nome.length();
- return caratteri;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement