Question d’entretien chez Thinkitive Technologies

Program to reverse the string

Réponses aux questions d'entretien

Utilisateur anonyme

4 déc. 2020

import java . lang . *; import java . io . *; import java . util .*; class ReverseString { public static void main(string[] args) { String input = "Vinayak" byte[] strAsByteArray = input . getBytes(); byte[] result = new byte[strAsByteArray.length]; for(int i = 0; i < strAsByteArray.length; i++) result[i] = strAsByteArray[strAsByteArray.length - 1 - 1]; System.out.println(new String(result)); Output: kayaniV

3

Utilisateur anonyme

12 déc. 2020

Char[] ch=str.tocharArray(); For(int i=ch.length; i>=0;i--) { Rev=rev+ ch.charAt(i); }

1