Make ABBA Problem: Given two strings, a and b, return the result of putting them together in the order abba.
Examples:
makeAbba("Hi", "Bye") → "HiByeByeHi"
makeAbba("Yo", "Alice") → "YoAliceAliceYo"
makeAbba("x", "y") → "xyyx"
In this problem a method that has two string as parameter for example string A and B should return a string that is in the order ABBA. For example 'Hi' and 'Bye' are passed as parameter then the result should be 'HiByeByeHi'.
Answer For this Java Bat problem:
public String makeAbba(String a, String b) { String str=a+b+b+a; return str; } |
Above Code can also be written in this way:
public String helloName(String a, String b) { return a+b+b+a; } |
No comments:
Post a Comment