I am currently working on a project for school that requires me to make an album library, and am being thrown error code "java.lang.NullPointerException" when using this:
public static void main(String[] args) {
Scanner kb=new Scanner(System.in);
AlbumCollection ac= new AlbumCollection();
Playlist p= new Playlist();
System.out.println("Welcome to bbco's music library!");
displayMenu();
Album a;
Song s;
int ch=getChoice();
while(ch!=8){
switch (ch) {
case 1:
a=createAlbum();
ac.addAlbum(a);
break;
case 2:
ac.displayAlbums();
break;
To call upon this:
public void displayAlbums(){
for(int i=0;i<numalbum;i++){
albumobjects[i].displayAlbum();
}
}
Any help would be greatly appreciated