string strings = "";
for (int i = 0; i <= str.length() -1; i++)
(
system.out.println(str.charAt(i) + "-");
(
)
what output is generated by this
what output is generated?
According to the above code,
NO OUTPUT WILL BE GENERATED
Because, you have initialized an empty string with name strings and you are trying to print the characters of str.charAt(i), in which str is not initialized.
I will write a simple code which is executable and get you understand.
Code:
I hope the above code, information and explanation will help you out to understand!
Please comment if you have any queries/errors!
Thank you!
Get Answers For Free
Most questions answered within 1 hours.