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 38 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
Wow, this really help


xiazhe

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

 

Did you know?

Eat fiber! A diet high in fiber can help lower cholesterol levels by as much as 10%.

Did you know?

The types of cancer that alpha interferons are used to treat include hairy cell leukemia, melanoma, follicular non-Hodgkin's lymphoma, and AIDS-related Kaposi's sarcoma.

Did you know?

Common abbreviations that cause medication errors include U (unit), mg (milligram), QD (every day), SC (subcutaneous), TIW (three times per week), D/C (discharge or discontinue), HS (at bedtime or "hours of sleep"), cc (cubic centimeters), and AU (each ear).

Did you know?

Every flu season is different, and even healthy people can get extremely sick from the flu, as well as spread it to others. The flu season can begin as early as October and last as late as May. Every person over six months of age should get an annual flu vaccine. The vaccine cannot cause you to get influenza, but in some seasons, may not be completely able to prevent you from acquiring influenza due to changes in causative viruses. The viruses in the flu shot are killed—there is no way they can give you the flu. Minor side effects include soreness, redness, or swelling where the shot was given. It is possible to develop a slight fever, and body aches, but these are simply signs that the body is responding to the vaccine and making itself ready to fight off the influenza virus should you come in contact with it.

Did you know?

Approximately 70% of expectant mothers report experiencing some symptoms of morning sickness during the first trimester of pregnancy.

For a complete list of videos, visit our video library