Hi Folks,
I could not figure out whats the problem here in my code.
I get the output when I enter same names and different names.
However, it states one of the requirement is missing.
package com.codegym.task.task04.task0421;
/*
Jen or Jen?
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
String name1 = sc.nextLine();
String name2 = sc.nextLine();
if (name1 == name2)
{
System.out.println("The names are identical");
}
else if((name1 != name2) && (name1.length() == name2.length()))
{
System.out.print("The names are the same length");
}
}
}