-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullNames.java
More file actions
24 lines (17 loc) · 728 Bytes
/
Copy pathfullNames.java
File metadata and controls
24 lines (17 loc) · 728 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
package com.promineotech;
import java.util.Scanner;
public class fullNames {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter your first name:");
String firstName = sc.nextLine();
System.out.println("Please enter your last name:");
String lastName = sc.nextLine();
System.out.println(fullName(firstName, lastName));
}
/* Write a method that takes two Strings, firstName and lastName, and returns a full name (the full name should be the first and the last name as a String separated by a space) */
public static String fullName(String firstName, String lastName) {
String fullName = firstName + " " + lastName;
return fullName;
}
}