0
    package Nauka;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Random;

    public class NaukaGamy {
    public static void main(String[] args) {
        ArrayList<Akord> gamy = new ArrayList<Akord>();

        gamy.add(new Akord("C dur\n\n","  c', d, e, f, g, a, h, c"));
        gamy.add(new Akord("C moll\n\n","  c, d, es, f, g, as, b"));

        System.out.println(gamy.get(1));

Result is : Nauka.Akord@7852e922

I'd to have secound line( C moll\n\n"," c, d, es, f, g, as, b) as solution. How to do it?

2tyggratis
  • 13
  • 1

1 Answers1

0

You need override toString() method in your class Akord. For example,

public class Akord {
    @Override
    public String toString() {
        return /*your fields to String*/;
    }
}
Andrew Tobilko
  • 48,120
  • 14
  • 91
  • 142