Given the following code, what is the output? public static String…
Question Answered step-by-step Given the following code, what is the output? public static String… Given the following code, what is the output?public static String magic(String s) { String r = “”; boolean got = false; for (int i = 0; i < s.length(); i++) { if (Character.isDigit(s.charAt(i))) { r = r + s.charAt(i); got = true; } else if (got) { return r; } } return r;}public static void main(String[] args) { System.out.println(magic("ABCd45&*31"));}Group of answer choices45 4531 45&* ABCd PreviousNext No new data to save Computer Science Engineering & Technology Java Programming CSE 110 Share QuestionEmailCopy link Comments (0)


