Examlex

Solved

What Is Wrong with the Following Code

question 24

Multiple Choice

What is wrong with the following code?
Public static int count(String s)
{
For (int i = 0; i < s.length() ; i++)
{
Int cnt = 0;
If (Character.isDigit(s.charAt(i) ) )
{
Cnt++;
}
}
Return cnt;
}


Definitions:

Numerator

The top number in a fraction that indicates how many parts of a whole are being considered.

Kilo-

A prefix in the metric system denoting a factor of one thousand.

Ounce

A unit of weight in the avoirdupois system, equal to 1/16 of a pound or approximately 28.35 grams.

Abbreviation

A shortened form of a word or phrase used to simplify written and verbal communication.

Related Questions