Question: Please show me how to fix my code, I can't figure out why it won't work. SameStarChar.java public class SameStarChar { /** Write the method

Please show me how to fix my code, I can't figure out why it won't work.

Please show me how to fix my code, I can't figure out

why it won't work. SameStarChar.java public class SameStarChar { /** Write the

method named sameStarChar(). Given a String str, return true if for every

** (star) in the string, if there are chars both immediately before

SameStarChar.java public class SameStarChar { /** Write the method named sameStarChar(). Given a String str, return true if for every ** (star) in the string, if there are chars both immediately before and after the star, they are the same. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Note: This is a little tricker than it looks. One way to look at the problem is to see in what circumstances you should return false. You only return false if the characters on either side of the * are different. That means that if there are no characters in front of, or behind the *, then you should return true, not false. Examples: sameStarChar("xy*yzz") returns true sameStarChar("xy*zzz") returns false sameStarChar("*xa*az") returns true @param str the input String to process. @return true if the characters before and after are the same. 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45} // TODO Write the sameStarChar method here. public boolean sameStarChar (String str) { int i = 0; boolean answer = true; while (i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!