This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 24183
    
  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]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: main driver class to instantiate my child classes
 
Similar Threads
Abstract
code is complete! but whats wrong here??
why to use Class.formName("")
cant figure out whats wrong with my absract class
Polymorphism? Quick Question