forked from SLIIT-FacultyOfComputing/sliit-faculty-of-computing-se2012-ooad-practical-02-SE2012-OOAD-Practical_002
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bq1p2.java
46 lines (28 loc) · 1.05 KB
/
bq1p2.java
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.Scanner;
public class bq1p2{
public static void main( String arg[]){
Scanner keyboard = new Scanner(System.in);
System.out.printf("enter first name : ");
String first = keyboard.nextLine();
System.out.printf("enter second name : ");
String second = keyboard.nextLine();
System.out.printf("enter third name : ");
String third = keyboard.nextLine();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(third);
stringBuilder.append(" ");
stringBuilder.append(first);
stringBuilder.append(" ");
stringBuilder.append(second);
String result1 = stringBuilder.toString();
System.out.println("StringBuilder result: " + result1);
System.out.printf("\n------------------------\n");
System.out.printf("enter your full name : ");
String fullname = keyboard.nextLine();
if (result1.equalsIgnoreCase(fullname)) {
System.out.printf("names are same");
}
else
System.out.printf("names are difrnc");
}
}