Basically, in able to check for the equality of the string, you should use the equals method rather than "=="
if(i.equals("Ronald"))
The Output which you will get:
Whose information do you want?[Ronald, Donald]
Ronald
Ronald is CEO and is in Room No 20
I hope this will help.
Want to become a Java Expert? join Java Training now!!
Want to know more about Java? Watch this video on Learn java | Java Programming for Beginners: