🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #143

Printing the Values of Class properties

#143
From: L Remond
Date: Mon, 24 May 2004 12:13
14 lines
1295 bytes
I have a class with about 30 properties and I would like to print the value of them all without using a System.out.println for each one.  I am using the following code to extract the properties from the class but I do not see any methods that wil allow me to print the values of them

    Field[] fields = this.getClass().getDeclaredFields();
     for ( int i=0; i < fields.length; i++ )
     {
        System.out.println(fields[i].getName() + " : values: "  );
     }


Is there a way to do this 


Thanks
Technical Details
Message-ID: <40b1e6ec$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,de5620ad508d2ac9,start
X-Google-Attributes: gid1089d0,public
From: "L Remond" <sirlanslot@aol.com>
Sender: "L Remond" <sirlanslot@aol.com>
Reply-To: "L Remond" <sirlanslot@aol.com>
Subject: Printing the Values of Class properties
Newsgroups: borland.public.jbuilder.java.api
X-User-Info: 64.214.127.50     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <40b1e6ec$1@newsgroups.borland.com>
Date: 24 May 2004 05:13:32 -0700
X-Trace: newsgroups.borland.com 1085400812 207.105.83.66 (24 May 2004 05:13:32 -0700)
Lines: 14
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail