-
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()
{
}
}
-
HistogramUI hui = new HistogramUI(...); // Create an instance of the class
hui.<put method name here>; // Call one of its methods
-
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
-
By ericelysia1 in forum Java
Replies: 34
Last Post: 05-15-2005, 06:39 PM
-
By Gengar003 in forum Java
Replies: 10
Last Post: 05-15-2005, 06:14 AM
-
By Larry Hayashi in forum Architecture and Design
Replies: 2
Last Post: 05-01-2003, 11:33 AM
-
By Frank Oquendo in forum .NET
Replies: 0
Last Post: 07-24-2002, 01:41 PM
-
By Luchador in forum Java
Replies: 3
Last Post: 07-23-2001, 11:05 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks