Class review


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Class review

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Class review

    Thanks for the help provided.!
    Last edited by latin_papi; 11-02-2005 at 01:10 PM.

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560

    Smile Neat

    You have a clean and consistent coding style and your Colour class is easy
    on the eye & brain. I cannot see anything that "needs" to be shorter,
    well, perhaps except for the equals method:

    Code:
    public boolean equals(Colours c) {
        return  (this.r == c.r) && (this.b == c.b) && (this.g == c.g);
    }
    My point is; why test a boolean value for true or false before returning it
    to the caller when you might as well just return the boolean right away.

    I have two suggestions for additions:

    1: a hex setter & getter ?

    2: a getRandomColor() method ?
    Last edited by sjalle; 11-02-2005 at 03:31 AM.
    eschew obfuscation

Similar Threads

  1. Help with class/applet
    By none_none in forum Java
    Replies: 17
    Last Post: 04-28-2005, 04:00 PM
  2. Replies: 5
    Last Post: 10-17-2002, 02:58 PM
  3. Assembly class
    By Shailesh C.Rathod in forum .NET
    Replies: 2
    Last Post: 03-13-2002, 08:53 PM
  4. How To Do It - Shared Class Variables Part III
    By Patrick Ireland in forum .NET
    Replies: 5
    Last Post: 05-10-2001, 07:19 PM
  5. Calling base class methods
    By GR in forum Java
    Replies: 1
    Last Post: 11-09-2000, 06:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center