メソッド searchSong() がメインで機能しません。クラスSongのオブジェクト配列は次のとおりです
public class Library{
Song[] thelist=new Song[10];
int counter=0;
private int i=0;
public void addSong(Song s){//adds Song method to array
if(i<thelist.length){
thelist[i]=s;
i++;}
else
public Song searchSong(String title, String album, String author, String interpreter) {
for(int j=0;j<thelist.length;j++)
if(thelist[j].title.equals(title) && thelist[j].album.equals(album) && thelist[j].author.equals(author) &&
thelist[j].interpreter.equals(interpreter))
return thelist[j];
return null;}
私のメインでは、thelist[j] を返すために、文字列のタイトル、アルバム、作成者、通訳者を入力する必要があります。
これが私のマニンです
Library list=new Library();
Song one=new Song();
list.addSong(one);
one.title="hello";
one.album="world";
one.interpreter="luar";
one.author="me";
}
list.searchSong(hello,world,luar,me);
list.searchSong() メソッドは何かを返すはずですが、このエラーが発生し続けます
TestLibrary.java:31: error: cannot find symbol
list.searchSong(hello,world,luar,me);
^
symbol: variable hello
location: class TestLibrary
TestLibrary.java:31: error: cannot find symbol
list.searchSong(hello,world,luar,me);