Given the following method: public void wild(char m) { m++; if (m >= \'X\'&& m <
ID: 3608339 • Letter: G
Question
Given the following method: public void wild(char m) { m++; if (m >= 'X'&& m <= 'Z' )System.out.println("ending...");
else if( m >= 'A' &&m <= 'W' )
{
System.out.println(m+ " is a capital letter");
wild(m);
} else System.out.println("Outof range."); } What is the output if the call wild( 'T'); is made? Given the following method: public void wild(char m) { m++; if (m >= 'X'&& m <= 'Z' )
System.out.println("ending...");
else if( m >= 'A' &&m <= 'W' )
{
System.out.println(m+ " is a capital letter");
wild(m);
} else System.out.println("Outof range."); } What is the output if the call wild( 'T'); is made? else System.out.println("Outof range."); } What is the output if the call wild( 'T'); is made? What is the output if the call wild( 'T'); is made?
Explanation / Answer
Wild(U) will increment the value of m (U) by one so it becomesV. Then it will see that V is between A and W so it will print "Vis a capital letter" and then it will call wild(V).
Wild(V) will increment the value of m (V) by one so it becomesW. Then it will see that W is between A and W so it will print "Wis a capital letter" and then it will call wild(W).
Wild(W) will increment the value of m (W) by one so it becomesX. Then it will see that X is between X and Z so it will say "ending...".
All told the output will look like this: U is a capital letter V is a capital letter W is a capital letter ending...
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.