Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class CrazyStrings Given the codes on the left, clearly write the output

ID: 3717835 • Letter: P

Question

public class CrazyStrings Given the codes on the left, clearly write the output from this code on the answer sheet. Some of the commonly used string methods are provided on the reference sheet. public static void main(String1 args) String mystring-new String("Hel1o") System.out.println(segment 1 System.out-printin(crazyl (mystring) System.out.printin (mystring) System.out.printinsegment 2 System.out.pzintin(crazy2 ("Hello" System.out.printinsegment 3 System.out.printin (crazy3("Hello, mystring)) System.out-printin(crazy3 ("Hello "Hel1) System.out.printinsegment 4** System.out.printin (crazy4 ("??")) ; System.out.pzintin (crazy4("Bye" public static Stzing crazyl (String stz) strestrCSEBB return str public static stzing crazy2 (Stzing str) if (str.equals ("Hello") return str.substring (2) else return str.substring (1) public static boolean crazy3 (String strl, String str2) return strl--stz2: public static String crazy4(String stz) if (str.length ( )%2"m]){ return 1+2+(3+.+(1+2)+3 elsel return (+2+3).+1+2-3

Explanation / Answer

output for the above code is

**segment 1**

HelloCSE8B

Hello

**segment 2**

llo

**segment 3**

False

True

**segment 4**

6,123

33,33