Hola persona
Submit solution
Points:
10
Time limit:
5.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
C#, Go, Java, Python
A partir del codi següent, crea la classe Persona
. Afegeix els atributs i mètodes necessaris.
import java.util.Locale;
import java.util.Scanner;
// Declara aqui la classe (sense cap modificador)
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
scanner.useLocale(Locale.ENGLISH);
Persona unaPersona = new Persona();
unaPersona.nom = scanner.next();
unaPersona.saludar();
Persona unaAltraPersona = new Persona();
unaAltraPersona.nom = scanner.next();
unaAltraPersona.saludar();
}
}
Input Format
-
Constraints
-
Output Format
-
Sample Input 0
Joan
Anna
Sample Output 0
Hola, em dic Joan
Hola, em dic Anna
Sample Input 1
Emma
Marc
Sample Output 1
Hola, em dic Emma
Hola, em dic Marc
Autoria: Gerard Falcó
CC BY-NC-SA 4.0