i want to call the arrays to the method and add it in a catalog but i cant print it as it shows [[Ljava.lang.String;@7ad041f3, [Ljava.lang.String;@251a69d7, [Ljava.lang.String;@7344699f] when i print it. i think its cause of the way i called the attribute title,author and genre but i dont know how to call.
import java.util.Scanner;
import java.util.Arrays;
public class Card{
String title[] = {"Hairy potter","Perck Jackson","The promised Neverland","Goosebump"};
String author[] = {"j.k.Rowling","Rick Riordan","Kaiu Shirai","R.L.Stine"};
String genre[] = {"Fantasy Fiction","Adventure","Dark fantasy","Horror fiction"};
public static void main(String[] args) {
Card obj = new Card();
String[] title1,author1,genre1;
title1 = obj.title;
author1 = obj.author;
genre1 = obj.genre;
String[][] catalog = new String[3][4];
for (int i = 0 ; i<4;i++){
catalog[0][i] =title1[i];
catalog[1][i] =author1[i];
catalog[2][i]= genre1[i];
}
System.out.println((catalog[0]));
System.out.println(Arrays.toString(catalog));
}
}
Edit: i had to use Arrays.deepToString(catalog)