java - How get secound line from ArrayList -


this question has answer here:

    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 : nauka.akord@7852e922

i'd have secound line( c moll\n\n"," c, d, es, f, g, as, b) solution. how it?

you need override tostring() method in class akord. example,

public class akord {     @override     public string tostring() {         return /*your fields string*/;     } } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -