Please tell me the solution of this program.

/* Compare names
Write a program that reads two names from keyboard, and if the names are the same, displays «Names are identical».
    Display «Name lengths are equal» if the names are different, but their lengths are equal.


public class Solution
    public static void main(String[] args) throws Exception
        //add your code here


asked 14 Mar '15, 04:53

Rajat's gravatar image

accept rate: 0%

edited 14 Mar '15, 08:36

Elleonora%20Carry's gravatar image

Elleonora Carry ♦♦

You must write your solution and people help you. Print ready solutions is prohibited the forum rules.


answered 14 Mar '15, 06:19

RabenokDmitry's gravatar image

accept rate: 14%

It works but not passed testing:( Write a program that reads from keyboard a string «name» and a date of birth (three numbers): y, m, d. The program should display to the screen: «My name's «name» I was born on d.m.y»

«My name's Joe
I was born on 15.2.1988


public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(; String name = reader.readLine(); String date = reader.readLine(); String month = reader.readLine(); String year = reader.readLine(); int d = Integer.parseInt(date); int m = Integer.parseInt(month); int y = Integer.parseInt(year); System.out.println("My name's " + name); System.out.println("I was born on " + d + "." + m + "." + y); } }


answered 05 Jan, 17:21

voland's gravatar image

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]( "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



Asked: 14 Mar '15, 04:53

Seen: 1,647 times

Last updated: 05 Jan, 17:21