import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String a = br.readLine();
String b = br.readLine();
Solution sol = new Solution();
sol.comparison("a","b");
}
private void comparison(String a,String b){
if (a.equals(b) ) System.out.println("The names are identical");
else if ((a.length()==b.length())) System.out.println("The names are the same length");
}
}
OUTPUT:
alex
alex
The names are the same length
Process finished with exit code 0
Can someone please enlighten me regarding why the first if statement is skipped?
Can you help?
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Miki
8 September 2019, 19:00solution
check your method call! :)
+2
Alexandru Savu
9 September 2019, 15:38
:))Thanks.
0