Fix the following program to display the position if found a…
Fix the following program to display the position if found and ” Letter doesn’t exist” otherwise: public static void main(String[] args) { String str = “CPSC1100 Final Exam”; boolean found = false; char ch = ‘?’; int position = 0; while (!found && position < str.length()) { ch = str.charAt(position); if (ch == 'z') { found = true; } else { position++; } } System.out.println("Position is: " + position); }
Read Details