回答編集履歴

1

説明の訂正

2019/03/14 04:45

投稿

退会済みユーザー
test CHANGED
@@ -20,21 +20,21 @@
20
20
 
21
21
  Scanner sc = new Scanner(System.in);
22
22
 
23
- String A = sc.nextLine();
23
+ String a = sc.nextLine();
24
24
 
25
- String B = sc.nextLine();
25
+ String b = sc.nextLine();
26
26
 
27
27
 
28
28
 
29
- String A_usiro = A.substring(A.length() - 1);
29
+ String aLast = A.substring(A.length() - 1);
30
30
 
31
- String B_mae = B.substring(0,1);
31
+ String bFirst = B.substring(0,1);
32
32
 
33
- String B_usiro = B.substring(B.length() - 1);
33
+ String bLast = B.substring(B.length() - 1);
34
34
 
35
35
 
36
36
 
37
- if(A_usiro.equals(B_mae) && (B_usiro != "n")){
37
+ if(aLast.equals(bFirst) && (bLast != "n")){
38
38
 
39
39
  System.out.println("OK");
40
40
 
@@ -80,21 +80,21 @@
80
80
 
81
81
  Scanner sc = new Scanner(System.in);
82
82
 
83
- String A = sc.nextLine();
83
+ String a = sc.nextLine();
84
84
 
85
- String B = sc.nextLine();
85
+ String b = sc.nextLine();
86
86
 
87
87
 
88
88
 
89
- char A_usiro = A.charAt(A.length() - 1);
89
+ char aLast = A.charAt(A.length() - 1);
90
90
 
91
- char B_mae = B.charAt(0);
91
+ char bFirst = B.charAt(0);
92
92
 
93
- char B_usiro = B.charAt(B.length() - 1);
93
+ char bLast = B.charAt(B.length() - 1);
94
94
 
95
95
 
96
96
 
97
- if(A_usiro == B_mae && B_usiro != 'n'){
97
+ if(aLast == bFirst && bLast != 'n'){
98
98
 
99
99
  System.out.println("OK");
100
100
 
@@ -120,6 +120,6 @@
120
120
 
121
121
  今回の質問には関係ないですが, 変数名を```Amae Ausiro Bmae```にするより
122
122
 
123
- .```A_mae A_usiro B_mae```にした方が後で見たとき読みやすいと思います.
123
+ .```aFirst aLast bFirst```にした方が後で見たとき読みやすいと思います.
124
124
 
125
125
  変数名なのでどちらでも構いませんが...