Question: need it in JAVA k t *Returns a string that consists of all and only the characters in positions n,2n, 3n, and so on in

 need it in JAVA k t *Returns a string that consists

need it in JAVA

k t *Returns a string that consists of all and only the characters in positions n,2n, 3n, and so on in the current string, starting either from the beginning or from the end of the * string. The characters in the resulting string should be in the same order and with the * same case as in the current string *If the current string is empty or has less than n characters, the method should return an * empty string *Examples: For n-2 and a string of one character, the method would return an empty string * -For n=2 and startFromEnd=false, the method would return the 2nd , 4th, 6th, and so on characters in the string. *For n-3 and startFromEnd-true, the method would return the 3rd from the last character *in the string, 6th from the last character in the string, and so on (in the order in which they appear n the string) Values n and startFromEnd are passed as parameters. The starting character, whether it is * the first one or the last one in the string, is considered to be in Position 1 param n Determines the positions of the characters to be returned *Gparam startFromEnd Determines whether to start counting from the end or from the beginning when identifying the characters in position n, 2n, 3n, and so on. Please note that the characters are always returned in the order in which they appear in the string. *@return String made of characters at positions n, 2n, and so on in the current string throws IllegalArgumentException If "n" less than or equal to zero throws Null PointerException If the current string is nu11 and "n" is greater than zero string getEveryNthCharacterFromBeginningorEnd (int n, boolean startFromEnd)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!