Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
0いいね 52 views回再生

Java Selenium Whiteboard Coding Q&A for Software Testing Job Interviews| Part 3

Question: How to reverse a String? Given String- "ABCD"
To reverse a string using Java, you should know the following concepts:
Concepts required-
Primitive Data Type Char (represent a single character)
Java Method (block of code executed when called)
Java String Class (array of characters) and some of the methods available in this class:
-Char charAt(int index)
int length()
For loop

To reverse a string, we will first find the size of the string. Once we have the size of the string, we can use for loop to iterate through the string to print the values of the string. The iteration process should start from the last character of the string. So, that we can print the characters in a reverse order.

コメント