“Pembalikan” Kode Jawaban

Pembalikan

public class ReverseStringByFavTutor

{

   public static void main(String[] args) {


       String stringExample  =  "FavTutor";

       System.out.println("Original string: "+stringExample);


       // Declaring a StringBuilder and converting string to StringBuilder

       StringBuilder reverseString = new StringBuilder(stringExample);


       reverseString.reverse();  // Reversing the StringBuilder


       // Converting StringBuilder to String

       String result = reverseString.toString();


       System.out.println("Reversed string: "+result); // Printing the reversed String


   }

}
Itchy Impala

pembalikan

  function reverseString(value){
    return value.split('').reverse().join('')
  }
Xanthous Xenomorph

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya