• Post Reply Bookmark Topic Watch Topic
  • New Topic

class  RSS feed

 
pravanya kantipudi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have some doubts in core java

1) can we initilalize the abstract class or interface with in a class?

2) can we instantiate the abstarct class or interface with in a class?

3) how to make the class cannot be instantiated?

i said the answer make it as abstract, the interwier wants another answer..

by using singleton we can create 1 object.but how we cant instantiate the class

4) in projects, what type of collections we use?

i konw one is arraylist

5) in projects,where we use exception handling?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't understand your question If this is what you meant,
AbstractClass ac = null; or
AbstractClass ac = getInstance();
then yeah, it's legal.


2) can we instantiate the abstarct class or interface with in a class?

No.


3) how to make the class cannot be instantiated?

Make its constructor private. Singleton is normally implemented by having the constructor as private. Then you get the instance by calling for example, public MyClass getInstance().


4) in projects, what type of collections we use?

It depends on what you need to use. Check the Java API on Collection class for more information.


5) in projects,where we use exception handling?

No fixed rules, it depends on you want to achieve.
[ July 01, 2007: Message edited by: Freddy Wong ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!