Question: What will be printed by this program? public class Question4 ( static String s1, s2,s3, s4; public static void main (String[] args) { s1=

What will be printed by this program? public class Question4 ( static String s1, s2,s3, s4; public static

What will be printed by this program? public class Question4 ( static String s1, s2,s3, s4; public static void main (String[] args) { s1= new String ("CAT"); s2 = new String ("DOG"); s3 new String ("RAT"); animal (s1, s2); System.out.println (mixThem (s2, s3)); } //main private static void animal (String al, String a2) { if (al.equals (a2)) System.out.println (al); else System.out.println (a2); } private static String mixThem (String bl, String b2) { String cl= bl; b1 = b2; b2 = new String ("HAT"); System.out.println (bl); System.out.println (b2); System.out.println(cl); System.out.println (s2); return b2; } //Question4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The program will print the following DOG HAT DOG DOG HAT The mixThem function takes two strings as input and returns the second string In this case th... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!