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

Write an application that demonstrates each of the following methods based on th

ID: 3758591 • Letter: W

Question

Write an application that demonstrates each of the following methods based on the following quote:

“You can never cross the ocean until you have the courage to lose sight of the shore.” – Christopher Columbus

indexOf(‘v’)

indexOf(‘x’)

charAt(16)

endsWith(“bus”)

endsWith(“car”)

replace(‘c’, ‘C’)

Think about how to approach a problem such as this one. In your main() method, you will need to declare a String to store the quote and then System.out.println() methods to output the results of each method call. Be sure to add System.out.println() statements to describe each line of output

Explanation / Answer

class EG{
   public static void main(String args[]){      
       String s = "You can never cross the ocean until you have the courage to lose sight of the shore.";      
       System.out.println(s.indexOf(‘v’))
       System.out.println(s.indexOf(‘x’))
       System.out.println(s.charAt(16))
       System.out.println(s.endsWith(“bus”))
       System.out.println(s.endsWith(“car”))
       System.out.println(s.replace(‘c’, ‘C’))
   }
}

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