Saturday, March 25, 2017

Simple Program in Java that Reverses a String


So I decided to code a simple program today in Java because my laptop is down and I cannot access Visual Studio to program in C#, which is the language I'm used to.

The program reverses any string you input and displays it backwards.

I discovered something that Java doesn't have which C# does. C# treats a string as an array but Java doesn't. So in line 34, in C#, I could've typed "words[i] = str[count];". Which is syntactic sugar compared to Java. Yet C# is considered more complex than Java which you can read about in this link. Since I'm a novice in Java and have been groomed in C#, I guess I WOULD find C# must easier.

Below is my code. Please comment if you have an easier way to code this.




No comments:

Post a Comment

How to Access the Metaverse

In February this year, Bernard Marr predicted that "in 2022, we'll see new, lighter, more portable VR devices, so instead of having...