116k views
3 votes
Assume that partNumber references a String object. The following if statement should perform a case-insensitive comparison. What is wrong with it? if (partNumber.equals("BQ789W4")) available = true;

1 Answer

5 votes

Answer:

A case sensitive comparission better to use library function strcmp().

Step-by-step explanation:

The part number references are string objects. In order to perform a case sensitive comparission? it is going to be better if one make use of a library function strcmp().

This will work best for a part number reference consideringthe fact that it is a string object. This is simply because, string objects are best implemented using library function when the string object happens to be used in a case sensitive comparison.

User Jarek Jarcec Cecho
by
4.8k points