“Java umkehren” Code-Antworten

wie man eine Zeichenfolge in Java umgeht

public class ReverseString {
    public static void main(String[] args) {
        String s1 = "neelendra";
        for(int i=s1.length()-1;i>=0;i--)
            {
                System.out.print(s1.charAt(i));
            }
    }
}
Annoying Anaconda

String Reverse in Java

String str = "Hello";
String reverse(String str){
  StringBuilder sb = new StringBuilder();
  sb.append(str);
  sb.reverse();
  return sb.toString();
}
Lonely Lark

Array Reverse in Java

        int[] xr = {1, 2, 3, 4, 5};

        System.out.print("[");
        for (int i = xr.length - 1; i >= 0; i--) {
            System.out.print(xr[i] + ", ");
        }
        System.out.println("\b\b]");
    }
Chathumal Sangeeth

Rückwärts in Jaav

// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
list = new ArrayList<int> {3, 4, 7};  //initialising a list
Collections.reverse(list);  //reverses a List or an ArrayList
//now, list is {7, 4, 3}
My real name : Vaalarivan P

Java umkehren

public void reverse()
    {
        for (int i = 0; i < size/2; i++)
        {
            int temp = get(i);
            elementData[i] = elementData[size-i-1];
            elementData[size-i-1] = temp;
        }
    }
Sid Potti

String Reverse in Java

1)
String str = "Hello";
String result = "";

  for(int i = str.length()-1; i>=0; i--){
     result += str.charAt(i); // first solution, charAt method
 //  result += str1.substring(i, i+1); // first solution,  substring method
   }
   System.out.println(result);
}

Ozzzy

Ähnliche Antworten wie “Java umkehren”

Fragen ähnlich wie “Java umkehren”

Weitere verwandte Antworten zu “Java umkehren” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen