-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEjercicio1.java
More file actions
27 lines (18 loc) · 786 Bytes
/
Ejercicio1.java
File metadata and controls
27 lines (18 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package Ejercicios;
import java.util.Scanner;
public class Ejercicio1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Introduzca su nombre: ");
String nombre = sc.nextLine();
System.out.print("Introduzca su edad: ");
int edad = sc.nextInt();
sc.nextLine();
System.out.print("Introduzca su ciudad: ");
String ciudad = sc.nextLine();
System.out.print("Introduzca su frase favorita: ");
String frase = sc.nextLine();
String fraseFinal = "Hola, " + nombre + ", su edad es " + edad + ".\nSu lugar de nacimiento es " + ciudad + ".\nY su frase favorita es " + frase;
System.out.println(fraseFinal);
}
}