View Single Post
  #1 (permalink)  
Old 07-25-2007, 10:32 PM
romina romina is offline
Member
 
Join Date: Jul 2007
Posts: 26
romina is on a distinguished road
Can this be done using abstract class??
Hi, I have some questions i am not sure and would like to seek some advice.
Is there any way i can call a method of a class without instantiating an object instance from the class?
Can this be done using abstract class?
Code:
public class CatCollection { public CatCollection() { ......... } public void addCat(Cat aCat) { //adds a Cat object to an array in CatCollection } } public class MainClass { public static void main(String[] args) { Cat kitty = new Cat(.......); CatCollection.addCat(kitty); --> how do i enable this to work? } }
Thanks.
Reply With Quote
Sponsored Links