This topic contains a solution. Click here to go to the answer

Author Question: To check if a string s contains the suffix "Java", you may write ________. (Read 29 times)

audragclark

  • Hero Member
  • *****
  • Posts: 579

Question 1

To check if a string s contains the prefix "Java", you may write ________.
◦ if (s.charAt(0) == 'J' && s.charAt(1) == 'a' && s.charAt(2) == 'v' && s.charAt(3) == 'a') ...
◦ if (s.startsWith("Java")) ...
◦ if (s.indexOf("Java") == 0) ...
◦ if (s.substring(0, 4).equals("Java")) ...

Question 2

To check if a string s contains the suffix "Java", you may write ________.
◦ if (s.endsWith("Java")) ...
◦ if (s.substring(s.length() - 5).equals("Java")) ...
◦ if (s.substring(s.length() - 4).equals("Java")) ...
◦ if (s.lastIndexOf("Java") >= 0) ...
◦ if (s.charAt(s.length() - 4) == 'J' && s.charAt(s.length() - 3) == 'a' && s.charAt(s.length() - 2) == 'v' && s.charAt(s.length() - 1) == 'a') ...


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by audragclark on May 6, 2020

anyusername12131

  • Sr. Member
  • ****
  • Posts: 327
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 29% of students answer this correctly




audragclark

  • Member
  • Posts: 579
Reply 2 on: May 6, 2020
:D TYSM


amit

  • Member
  • Posts: 364
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Always store hazardous household chemicals in their original containers out of reach of children. These include bleach, paint, strippers and products containing turpentine, garden chemicals, oven cleaners, fondue fuels, nail polish, and nail polish remover.

Did you know?

Barbituric acid, the base material of barbiturates, was first synthesized in 1863 by Adolph von Bayer. His company later went on to synthesize aspirin for the first time, and Bayer aspirin is still a popular brand today.

Did you know?

For high blood pressure (hypertension), a new class of drug, called a vasopeptidase blocker (inhibitor), has been developed. It decreases blood pressure by simultaneously dilating the peripheral arteries and increasing the body's loss of salt.

Did you know?

To combat osteoporosis, changes in lifestyle and diet are recommended. At-risk patients should include 1,200 to 1,500 mg of calcium daily either via dietary means or with supplements.

Did you know?

People about to have surgery must tell their health care providers about all supplements they take.

For a complete list of videos, visit our video library