Telegram Group & Telegram Channel
🤔Вопрос-ответ. Как перевернуть строку в Java?

👩‍💻Один из вариантов решения:
public class StringPrograms {
public static void main(String[] args) {
String str = "123";
System.out.println(reverse(str));
}

public static String reverse(String in) {
if (in == null)
throw new IllegalArgumentException("Null is not valid input");
StringBuilder out = new StringBuilder();
char[] chars = in.toCharArray();
for (int i = chars.length - 1; i >= 0; i--)
out.append(chars[i]);
return out.toString();
}

}


#собеседование
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/javarocks/232
Create:
Last Update:

🤔Вопрос-ответ. Как перевернуть строку в Java?

👩‍💻Один из вариантов решения:

public class StringPrograms {
public static void main(String[] args) {
String str = "123";
System.out.println(reverse(str));
}

public static String reverse(String in) {
if (in == null)
throw new IllegalArgumentException("Null is not valid input");
StringBuilder out = new StringBuilder();
char[] chars = in.toCharArray();
for (int i = chars.length - 1; i >= 0; i--)
out.append(chars[i]);
return out.toString();
}

}


#собеседование

BY JavaRocks


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/javarocks/232

View MORE
Open in Telegram


JavaRocks Telegram | DID YOU KNOW?

Date: |

The SSE was the first modern stock exchange to open in China, with trading commencing in 1990. It has now grown to become the largest stock exchange in Asia and the third-largest in the world by market capitalization, which stood at RMB 50.6 trillion (US$7.8 trillion) as of September 2021. Stocks (both A-shares and B-shares), bonds, funds, and derivatives are traded on the exchange. The SEE has two trading boards, the Main Board and the Science and Technology Innovation Board, the latter more commonly known as the STAR Market. The Main Board mainly hosts large, well-established Chinese companies and lists both A-shares and B-shares.

To pay the bills, Mr. Durov is issuing investors $1 billion to $1.5 billion of company debt, with the promise of discounted equity if the company eventually goes public, the people briefed on the plans said. He has also announced plans to start selling ads in public Telegram channels as soon as later this year, as well as offering other premium services for businesses and users.

JavaRocks from us


Telegram JavaRocks
FROM USA