¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
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); } }
1 Respuesta
+ 8
Fixed, feel free to ask if you have any question :) https://code.sololearn.com/cfwBocUt48xr/#java