Saturday, 7 September 2013

How to declare method return value?

How to declare method return value?

Ok, i have this class Libray that uses another class named Book. I want to
make a method that erase an object book in the array inventary, but i dont
how to declare the return value of the method.
public class Library {
private Book[] inventary;
private int booksquantity;
public Library eraseBook(int num){ for(int i = 0; i
if((inventary[i] == inventary[num-1]) && (inventary[i+1] != null)){
inventary[i+1]= inventary[i];
}
else if(inventary[i] == inventary[num-1]){
inventary[i] = null;
}
}
return ;
}
}
Thanks!!

No comments:

Post a Comment