public class array
{
public static void main (String[]args)
{
}
public static int[] create (int size)
{
int[]a=new int [size];
for (int i=2;i<a.length;i=i+2)
{
a[i]=i;
}
return a;
}
public static void print(int[]a)
{
for (int i=2; i<a.length;i++)
{
System.out.print(a[i]);
}
}
public static boolean found(int[]a,int item)
{
for (int i=2;i<a.length;i++)
{
if(a[i]==item)
{
return true;
}
else
{
return false;
}
}
}
public static int[] grow(int[]a)
{
int[]b=new int[a.length+1];
b[0]=0;
for (int i=0; i<a.length;i++)
{
b[i]=a[i-1];
}
return b;
}
}
This is my array coad.
- size 2.print 3.found the value false or true 4.add number the front part Did I do something wrong? What means a missing return statement? when I try to compile this it doesn't work. Is there something wrong with this? the error is in the boolean last bracket. But I can't find the wrong part. It seems all correct.