Advertisement
Fawers

java vs scala

Oct 17th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.54 KB | None | 0 0
  1. // uma possível classe Pessoa
  2. // java
  3. public class Pessoa
  4. {
  5.     private String  nome;
  6.     private int     idade;
  7.     private char    sexo;
  8.  
  9.     public Pessoa(String nome, int idade, char sexo)
  10.     {
  11.         this.nome  = nome;
  12.         this.idade = idade;
  13.         this.sexo  = sexo;
  14.     }
  15.  
  16.     public String getNome()
  17.     {
  18.         return nome;
  19.     }
  20.  
  21.     public int getIdade()
  22.     {
  23.         return idade;
  24.     }
  25.  
  26.     public char getSexo()
  27.     {
  28.         return sexo;
  29.     }
  30. }
  31.  
  32. // scala
  33. class Pessoa(val nome: String, val idade: Int, val sexo: Char)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement