Check Two Persons Are Same Problem Solution in Java | Capgemini ADAPT 2022 Solutions
Check Two Persons Are Same Problem Solution in Java | Capgemini ADAPT 2022 Solutions

In this post, you will get the solution to the Capgemini ADAPT 2022 solution to the problem Check Two Persons Are Same in Java. Capgemini ADAPT Java Solutions 2022, Check Two Persons Are Same.

Note: The solutions are provided for learning purposes only. 

Check Two Persons Are Same Problem Description:


Create a Person Class, Add necessary getters/setters to Person Class Create 2 Objects of The Person class, Check if 2 Objects of The Person class are the Same.

Person class has the following attributes

String name;

int age;

char gender;

Note: Override the equal() of the Object class and write the logic to check object equality of Objects in this method, code not written here to check the same, will not be considered…

Note: the Output are case-sensitive—> Example “Same” and “same” are not valid so kindly take care of the case-sensitivity

Check Two Persons Are Same Problem Solution in Java:


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Source{
public static void main(String args[]) throws Exception{
Scanner s = new Scanner(System.in);
String name = s.next();
int a = s.nextInt();
String g = s.next();
String name1 = s.next();
int a1 = s.nextInt();
String g1 = s.next();
if(name.equals(name1) && a==a1 && g.equals(g1))
{
System.out.println("Same");
}
else
{
System.out.println("Different");
}
}

 

TOP COMPANIES HIRING DRIVE

BATCHWISE OFF-CAMPUS DRIVES

1. TCS OFF-CAMPUS DRIVES1. 2018 BATCH
2. INFOSYS OFF-CAMPUS DRIVES2. 2019 BATCH
3. COGNIZANT OFF-CAMPUS DRIVES3. 2020 BATCH
4. WIPRO OFF-CAMPUS DRIVES4. 2021 BATCH
5. CAPGEMINI OFF-CAMPUS DRIVES5. 2022 BATCH

 

To Stay Up-to-date, Follow us on Social Media:


1.      Join our Telegram Channel:

Click Here

2.      Like us on Facebook:

Click Here

3.      Follow us on Instagram:

Click Here

4.      Follow us on LinkedIn:

Click Here

5.      Follow us on Google News:

Click Here

 

ADAPT Different Coding Solutions:


  1. Largest Array Solution – Click Here
  2. Batsman & Bowler Solution – Click Here
  3. Instruments Problem Solution – Click Here
  4. Check Two Person Are Same – Click Here

Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):


Capgemini ADAPT Sprint 2 (Bus Reservation System):


Study Materials for Interview Preparation (FREE MATERIALS):


  1. 240 Core Java Questions & Answers with PDF Download Link – Click Here
  2. 230+ SQL interview questions & answers pdf download – Click Here
  3. 50 LeetCode Interview Questions with Answers – PDF Notes – Click Here