-
/*Java Reverse String Array ExampleThis Java Reverse String Array example shows how to find sort an array ofString in Java using Arrays and Collections classes.*/
import java.util.Collections;import java.util.List;import java.util.Arrays;
public class ReverseStringArrayExample {
public static void main(String args[]){
//String arrayString[] strDays = new String[]{“Sunday”, “Monday”, “Tuesday”, “Wednesday”};
/** There are basically two methods, one is to use temporary array and* manually loop through the elements of an Array and swap them or to use* Arrays and Collections classes.** This example uses the second approach i.e. without temp variable.**///first create a list from String arrayList<String> list = Arrays.asList(strDays);
//next, reverse the list using Collections.reverse methodCollections.reverse(list);
//next, convert the list back to String arraystrDays = (String[]) list.toArray();
System.out.println(“String array reversed”);
//print the reversed String arrayfor(int i=0; i < strDays.length; i++){System.out.println(strDays[i]);}
}
}
/*Output of above given Java Reverse String Array example would beString array reversedWednesdayTuesdayMondaySunday*/
Friday, 13 April 2018
Popular Posts
-
If you’ve ever been curious about machine learning but felt overwhelmed by complex mathematics, heavy theory, or intimidating jargon — thi...
-
Deep learning is reshaping the way machines perceive the world — from recognizing objects in images to interpreting signals in real time. ...
-
Step-by-step explanation 1️⃣ Create the list lst = [1, 2, 3] The list has 3 elements . 2️⃣ Loop using index for i in range(len(lst)):...
-
Code Explanation: 1️⃣ Tuple Initialization t = ((1, 2), (3, 4), (5, 6)) t is a tuple of tuples. Each inner tuple has exactly two elements....
-
Want to use Google Gemini Advanced AI — the powerful AI tool for writing, coding, research, and more — absolutely free for 12 months ? If y...
-
In the age of data-driven decisions, understanding not just what a model predicts, but why and how confident it is in those predictions...
-
Explanation: ๐น Line 1: Creating the List n = [2, 4] A list n is created with two elements: 2 and 4. ๐น Line 2: Creating the map Object m ...
-
๐ Day 21: Stacked Area Chart in Python ๐น What is a Stacked Area Chart? A Stacked Area Chart displays multiple data series stacked on to...
-
In today’s data-driven world, learning how to extract insight from raw information is one of the most valuable skills you can have. A Hand...
-
Introduction to IBM AI Product Manager Professional Certificate Artificial Intelligence is transforming industries at an unprecedented pac...
Categories
100 Python Programs for Beginner
(118)
AI
(200)
Android
(25)
AngularJS
(1)
Api
(7)
Assembly Language
(2)
aws
(28)
Azure
(8)
BI
(10)
Books
(262)
Bootcamp
(1)
C
(78)
C#
(12)
C++
(83)
Course
(84)
Coursera
(299)
Cybersecurity
(29)
data
(1)
Data Analysis
(25)
Data Analytics
(18)
data management
(15)
Data Science
(286)
Data Strucures
(15)
Deep Learning
(117)
Django
(16)
Downloads
(3)
edx
(21)
Engineering
(15)
Euron
(30)
Events
(7)
Excel
(18)
Finance
(9)
flask
(3)
flutter
(1)
FPL
(17)
Generative AI
(59)
Git
(9)
Google
(47)
Hadoop
(3)
HTML Quiz
(1)
HTML&CSS
(48)
IBM
(41)
IoT
(3)
IS
(25)
Java
(99)
Leet Code
(4)
Machine Learning
(241)
Meta
(24)
MICHIGAN
(5)
microsoft
(9)
Nvidia
(8)
Pandas
(13)
PHP
(20)
Projects
(32)
Python
(1254)
Python Coding Challenge
(1032)
Python Mistakes
(50)
Python Quiz
(422)
Python Tips
(5)
Questions
(3)
R
(72)
React
(7)
Scripting
(3)
security
(4)
Selenium Webdriver
(4)
Software
(19)
SQL
(46)
Udemy
(17)
UX Research
(1)
web application
(11)
Web development
(8)
web scraping
(3)

0 Comments:
Post a Comment