You are given a Java program that is supposed to grab a certain character from a string and display it alongside a message in the console. However, this program is incomplete and contains three missing parts. Your task is to fill the blanks in the code to make it run correctly and print the specified character from the string 'Hello, User!'.
String
Fixing code to display a character from a string
Report a typo
Fill in the gaps with the relevant elements
public class Main {
public static void main([] args) {
String myString = "Hello, User!";
char myChar = myString.(7);
String output = "Character at index 7 is: " + myChar;
(output);
}
} ___
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.