Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1,To check if a string s contains the suffix Java, you may write ________. if (s.endsWith(Java)) ... if (s.lastIndexOf(Java) >= 0) ... if (s.substring(s.length() -

1,To check if a string s contains the suffix "Java", you may write ________.

if (s.endsWith("Java")) ...

if (s.lastIndexOf("Java") >= 0) ...

if (s.substring(s.length() - 4).equals("Java")) ...

if (s.substring(s.length() - 5).equals("Java")) ...

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') ...

2, Suppose s1 and s2 are two strings. Which of the following statements or expressions is incorrect?

String s3 = s1 - s2;

boolean b = s1.compareTo(s2);

char c = s1[0];

char c = s1.charAt(s1.length());

3, The ________ method parses a string s to a double value.

double.parseDouble(s);

Double.parsedouble(s);

double.parse(s);

Double.parseDouble(s);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago