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

Can anybody explains how the strings work to show the output 1 public class Para

ID: 3760323 • Letter: C

Question

Can anybody explains how the strings work to show the output

1 public class ParameterMystery {
2 public static void main(String[] args) {
3 String x = "java";
4 String y = "tyler";
5 String z = "tv";
6 String rugby = "hamburger";
7 String java = "donnie";
8 hamburger(y,z,x);
9 hamburger(x, y, z);
10 hamburger(z, x, y);
11 hamburger("rugby", z, java);
12 hamburger(y, rugby, "x");
13 hamburger(y, y, "java");
14 }
15
16 public static void hamburger(String y, String z, String x) {
17 System.out.println(z + " and " + x + " like " + y);
18 }
19 }

Explanation / Answer

"+" operator acts as a concating operator in java;

when "and"+"like" this will be giving us the ouput andlike

suppose there are two string variables in above program x and y

these when operated with operator "+" then x+y=xy=javatyler so on

just remember + between strings means concating

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote