public class ReverseString {
/**
* @param args
*/
public static void main(String[] args) {
//String[] name = new String[10];
String name , rev = "";
Scanner in = new Scanner(System.in);
System.out.println("Enter the string for reversal :- ");
name = in.nextLine();
int len = name.length();
for(int i = len-1;i>=0;i--){
rev = rev + name.charAt(i);
}
System.out.println(rev);
}
}
A blog about new technology, Android, iOS, Mobile Automation, Appium, Web Automation, Selenium, JAVA, Shell Scipting, Powershell, Testing Tools, QA, Spring Boot, Free Software, How to design best frameworks etc..
Java : Program to reversing a string
Java : Program swapping two numbers without using third variable
public class SwapTwoNo {
/**
* @param args
*/
public static void swap(int a , int b){
a = b+a;
b = a-b;
a = a-b;
System.out.println("Values of a and b after swap := " + a +" "+ b + " respectively");
}
public static void main(String[] args) {
int a = 5;
int b = 6;
System.out.println("Values of a and b before swap := " + a +" "+ b + " respectively");
swap(a,b);
}
}
Subscribe to:
Posts (Atom)
πAnnouncement : Visit the new website/blog π
πππ Announcement : Visit the new website/blog πππ Dear readers, Thank you for reading my blog. If you could have used the little info...
-
How to find the UDID of Android Device What is UDID : It stands for Unique Device Identifier. UDID is required duri...
-
How to change language of device using commandLine Changing language in Android device on-the fly is needed when we are running or exe...
-
To setup Appium for mobile automation, you will need below items to be configured in your test environment. 1. Appium server : 1.1 D...
-
How to get the package name of Android application There are multiple ways in which we can obtain the package name of Android .apk file. ...