Reversal_code

Run Settings
LanguageJava
Language Version
Run Command
public class Main{ public static void main(String[] args){ String[] cities = {"Boston", "New York", "New Wark", "Philly", "Los Agels" }; for (int i = 0; i < cities.length/2; i++){ //store temporary value String city = cities[i]; //swap the elements from front to back cities[i] = cities[cities.length-1 - i]; cities[cities.length-1-i] = city; } //print the result for (int i = 0; i < cities.length; i++){ System.out.println(cities[i]); } } }
Editor Settings
Theme
Key bindings
Full width
Lines