0

I'm not getting how to give the value to the size of array in main method?????.and how pass array value...findNumber is static

public class NewMain{ static String findnumber(int a[],int k){ String[] s1= {"YES","NO"}; for(int i=0;i<a.length;i++){ if( a[i] == k){ return s1[0]; break; } return s1[1]; }} public static void main(String args[]){ NewMain.findNumber(5,2); } }

11th Dec 2017, 7:25 AM
Zameer shaikh
Zameer shaikh - avatar
1 Respuesta
+ 8
Fixed, feel free to ask if you have any question :) https://code.sololearn.com/cfwBocUt48xr/#java
11th Dec 2017, 8:28 AM
Shamima Yasmin
Shamima Yasmin - avatar