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


debra928

  • Member
  • Posts: 342
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Never take aspirin without food because it is likely to irritate your stomach. Never give aspirin to children under age 12. Overdoses of aspirin have the potential to cause deafness.

Did you know?

The Romans did not use numerals to indicate fractions but instead used words to indicate parts of a whole.

Did you know?

The longest a person has survived after a heart transplant is 24 years.

Did you know?

Intradermal injections are somewhat difficult to correctly administer because the skin layers are so thin that it is easy to accidentally punch through to the deeper subcutaneous layer.

Did you know?

Famous people who died from poisoning or drug overdose include, Adolf Hitler, Socrates, Juan Ponce de Leon, Marilyn Monroe, Judy Garland, and John Belushi.

For a complete list of videos, visit our video library