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 44 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
YES! Correct, THANKS for helping me on my review


Kedrick2014

  • Member
  • Posts: 359
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

It is important to read food labels and choose foods with low cholesterol and saturated trans fat. You should limit saturated fat to no higher than 6% of daily calories.

Did you know?

A strange skin disease referred to as Morgellons has occurred in the southern United States and in California. Symptoms include slowly healing sores, joint pain, persistent fatigue, and a sensation of things crawling through the skin. Another symptom is strange-looking, threadlike extrusions coming out of the skin.

Did you know?

The cure for trichomoniasis is easy as long as the patient does not drink alcoholic beverages for 24 hours. Just a single dose of medication is needed to rid the body of the disease. However, without proper precautions, an individual may contract the disease repeatedly. In fact, most people develop trichomoniasis again within three months of their last treatment.

Did you know?

About one in five American adults and teenagers have had a genital herpes infection—and most of them don't know it. People with genital herpes have at least twice the risk of becoming infected with HIV if exposed to it than those people who do not have genital herpes.

Did you know?

There are actually 60 minerals, 16 vitamins, 12 essential amino acids, and three essential fatty acids that your body needs every day.

For a complete list of videos, visit our video library