Reverse string in java
public class reverse_string {
public static void main(String[] args) {
String str="nit kurukshetra is a good college in india";
char arr[]=str.toCharArray();
int j=arr.length-1;
int i=0;
while(i<j){
char ch=arr[i];
arr[i]=arr[j];
arr[j]=ch;
i++;
j--;
}
for (int k = 0; k < arr.length; k++) {
System.out.print(arr[k]);
}
}
}
Check a string value is Integer or not in java. (Solution).
Check ia string is hexadecimal number or not (Solution).
Generate Combination in java (Solution).
Generate permutation of string(Solution).
Reverse string in java (Solution).
Find duplicate characters with occurrences in a string(Solution).
Permutation of a number(Soluion).
Split the String in java(Solution).
Convert string into number in java(Solution).
Swap two strings without using any variable(Solution).
Get a number from a string in java(Solution).
Add Two Big Number In Java(Solution).
Expand String(Solution).
Reverse String (Solution).
public class reverse_string {
public static void main(String[] args) {
String str="nit kurukshetra is a good college in india";
char arr[]=str.toCharArray();
int j=arr.length-1;
int i=0;
while(i<j){
char ch=arr[i];
arr[i]=arr[j];
arr[j]=ch;
i++;
j--;
}
for (int k = 0; k < arr.length; k++) {
System.out.print(arr[k]);
}
}
}
Related Posts:
Check a string value is Integer or not in java. (Solution).
Check ia string is hexadecimal number or not (Solution).
Generate Combination in java (Solution).
Generate permutation of string(Solution).
Reverse string in java (Solution).
Find duplicate characters with occurrences in a string(Solution).
Permutation of a number(Soluion).
Split the String in java(Solution).
Convert string into number in java(Solution).
Swap two strings without using any variable(Solution).
Get a number from a string in java(Solution).
Add Two Big Number In Java(Solution).
Expand String(Solution).
Reverse String (Solution).
No comments:
Post a Comment