File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes main driver class to instantiate my child classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main driver class to instantiate my child classes" Watch "main driver class to instantiate my child classes" New topic
Author

main driver class to instantiate my child classes

alaina peeler
Greenhorn

Joined: Dec 04, 2005
Posts: 29
im writting a program with an abstract class called shape. then i will write child classes of circle, square..and etc. .....im supposed to then write a main driver class that instantiate my child classes and exercise the behaviors i provide.........the behaviors are just area and circumference of each shape......im confused on the main driver class.....how do i use the driver class to instantiate my child classes and exercise their behaviors?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

A more detailed paraphrase:

Write a class with a main() method with the proper signature. In that method, use the "new" operator to create instances of your classes. Store them into variables: some variables of type "Shape", and others of type "Square", "Triangle", etc. Then call their methods, and print the results.


[Jess in Action][AskingGoodQuestions]
 
 
subject: main driver class to instantiate my child classes