Help With Accessing methods from other classess


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Help With Accessing methods from other classess

  1. #1
    Join Date
    Sep 2004
    Posts
    103

    Help With Accessing methods from other classess

    Okay I've been given this problem, I'm using software called BlueJ and I think it sucks, I think it sucks because it has a lack of examples of what we need to work, I would like to ask with this program I have, How do I access methods from one class to another, I think this is called polymorphism if I'm correct?

    Okay the other class is Called HistogramUI

    It has these methods in it
    public void setVisible() { }
    public void paint(Graphics graphics) { }
    private int getHeight(int int0, int int1) { return 0;}
    public void setMax(int int0) { }
    public void setMedian(double double0) { }
    public void setMode(String string) { }
    public void setMean(double double0) { }
    public void setRollCount(int int0, int int1) { }
    How would I call these methods from the class below Histogram?

    Any Helps, Hints, Solutions Very needed on this program! Thanks Everyone

    public class Histogram
    {

    public Histogram( long seed )
    {

    }

    /**
    * This method needs to call the HistogramUI methods to set up and
    * display a Histogram.
    */
    public void displayHistogram()
    {

    }
    }

  2. #2
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    HistogramUI hui = new HistogramUI(...); // Create an instance of the class
    hui.<put method name here>; // Call one of its methods

  3. #3
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Polymorphism is not the ability to call another object's methods.

    Polymorphism is the ability to use one name to call a method or work with an object BUT you don't know exactly which implementation of the method [overriding] or which class or object [inheritance (extends) or interface (implements)] you'll be calling until "run time" - an example of "dynamic late binding" (the time at which a connection is made between caller and callee) which is allowed by Java.

Similar Threads

  1. Comparison methods
    By ericelysia1 in forum Java
    Replies: 34
    Last Post: 05-15-2005, 07:39 PM
  2. Replies: 10
    Last Post: 05-15-2005, 07:14 AM
  3. How to model "virtual" attributes and methods in UML
    By Larry Hayashi in forum Architecture and Design
    Replies: 2
    Last Post: 05-01-2003, 12:33 PM
  4. Hiding methods from COM
    By Frank Oquendo in forum .NET
    Replies: 0
    Last Post: 07-24-2002, 02:41 PM
  5. Replies: 3
    Last Post: 07-23-2001, 12:05 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