This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228809 - arrays and toString() method
Summary: arrays and toString() method
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2013-04-21 07:27 UTC by rafo
Modified: 2013-09-02 14:19 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description rafo 2013-04-21 07:27:16 UTC
Assume we have a class with an array:

class MyClass {

     private int[] abc = new int[]{123, 456, 789};


Now, If we generate toString() method to this class, we will get:

    public String toString() {
        return "MyClass{abc = " + abc + '}';

and it will print something like: 


I suggest to improve toString() method generation for arrays to use Arrays.toString() for generating String output for arrays. And our toString() method for the aforecited class will look like:

    public String toString() {
        return "MyClass{abc = " + Arrays.toString(abc) + '}';

and will produce more readable output:

MyClass{abc=[123, 456, 789]}