Question : return type missing

Hi

i have got a very simple code and i see once i exceute it it says return type is missing though i have specified return type. please let me know if i am missing something.

public String enhdtest(String country,Container container){
   //write your code here
 
int indcount= 0;
int usacount= 0;
 
if(country.equals( "INDIA"))
indcount ++;

if(country.equals( "USA"))
usacount++;

if(indcount != 0)
return "BSINDIA";

if(usacount != 0)
return "BSUSA";

}
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
public String enhdtest(String country,Container container){

 
int indcount= 0; 
int usacount= 0;
 
if(country.equals( "INDIA"))
indcount ++;

if(country.equals( "USA"))
usacount++;

if(indcount != 0)
return "BSINDIA";

if(usacount != 0)
return "BSUSA";

}

Answer : return type missing

If both if's are false, it is not returning anything
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
public String enhdtest(String country,Container container){

 
int indcount= 0; 
int usacount= 0;
 
if(country.equals( "INDIA"))
indcount ++;

if(country.equals( "USA"))
usacount++;

if(indcount != 0)
return "BSINDIA";

if(usacount != 0)
return "BSUSA";

return "DEFAULT";
}
Random Solutions  
 
programming4us programming4us