Here is my code

import java.io.*;

public class Solution

{ public static void main(String[] args) throws Exception

{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the first name from the keyboard: ");
    String a = reader.readLine();
    System.out.println("Enter the second name from the keyboard: ");
    String b = reader.readLine();
    if (a.equals(b))
        System.out.println("Names are identical");
    else if (a.length() == b.length())
    System.out.println("Name lengths are equal");
}

}

Program is working. I've checked & runned it through IntelliJ IDEA. But still I've got

✓ The program is compiled without errors. ✗ The program runs correctly but it has not pass testing. This is program output during runtime:

Enter the first name from the keyboard: Enter the second name from the keyboard: Names are identical

What is wrong. I don't get it. Please, help me

asked 01 Nov '17, 11:15

igor's gravatar image

igor
1
accept rate: 0%


1 try to remove your own text "Enter the first name from the keyboard: "

2 second if statement put in { braces }

3 также существует форум к русской версии сайта, можно там посмотреть варианты

link

answered 09 Nov '17, 01:31

andrew-k's gravatar image

andrew-k
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×63
×40
×35

Asked: 01 Nov '17, 11:15

Seen: 204 times

Last updated: 09 Nov '17, 01:31