Computer Applications

A manager wants to check the number of employees with names ending with KUMAR, and fill in the blanks in the given program segment with appropriate Java statements:

void count(String s[]) 
{ 
    int i, l=_________, c=0; 
    for(i=0;i<l;i++) 
    { 
    if(________________) 
    c++; 
    } 
    System.out.println(c); 
}                       

Java String Handling

8 Likes

Answer

void count(String s[]) 
{ 
    int i, l = s.length, c = 0; 
    for(i = 0; i < l; i++) 
    { 
        if(s[i].endsWith("KUMAR")) 
            c++; 
    }
    System.out.println(c); 
}                   

Answered By

3 Likes


Related Questions