You are given a java program that has been written in a non-sequential or non-logical order. Your task is to rearrange the lines of code given to you, so that the program will output the character at the 5th index of a string defined in the program. The string in our program is 'Hello, World!'. Remember, indexes start at 0.
String
Extracting a specific character from a greeting message
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
public static void main(String[] args) {
char charAtIndex5 = myStr.charAt(5);
String myStr = "Hello, World!";
public class Main {
}
System.out.println("Character at 5th index is: " + charAtIndex5);
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.