Code a method called encrypt to encrypt a String by swapping each pair of its adjacent characters.
Fantastic news! We've Found the answer you've been seeking!
Question:
Code a method called encrypt to encrypt a String by swapping each pair of its adjacent characters.
In the case of Strings with an odd number of characters pad them with a trailing space before encryption.
For example, "Hi there!" would be encrypted as "iHt eher !". You are not required to deal with an empty array.
Related Book For
Posted Date: