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 35 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


cassie_ragen

  • Member
  • Posts: 347
Reply 3 on: Yesterday
Excellent

 

Did you know?

The human body produces and destroys 15 million blood cells every second.

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?

Atropine, along with scopolamine and hyoscyamine, is found in the Datura stramonium plant, which gives hallucinogenic effects and is also known as locoweed.

Did you know?

In women, pharmacodynamic differences include increased sensitivity to (and increased effectiveness of) beta-blockers, opioids, selective serotonin reuptake inhibitors, and typical antipsychotics.

Did you know?

Asthma occurs in one in 11 children and in one in 12 adults. African Americans and Latinos have a higher risk for developing asthma than other groups.

For a complete list of videos, visit our video library