Tuesday, April 26, 2005

Doubts - Nitin Sharma

Dear friends,

Mr. Nitin Sharma has the following doubts. Please leave your answers in the comments section.I will leave my answer in comment section in a while.

1)a difference between abstract class and interface..

2)can the wait() method of the threads be overridden?if so why?

3)what exactly is a reference.? eg:- Graphics g

Send in your questions to be posted here to dream.java@gmail.com

Thanks

11 Comments:

Blogger Abhinav Anand said...

1)a difference between abstract class and interface..

Interface is a sort of abstraction which does has not has any implementation. It is suitable for defining an abstraction for full functionality has to be declared.

As regarding abstract class, sometimes when we create a generalized class, (for example, a class called Figure) it is not possible to implement all its member methods. For example, we cannot implement the area() method in the Figure class. In such cases, it is left to the subclasses to implement such methods.

Also since java class can extend a single class, and can implement multiple interfaces. So this is a design decision whether to make a parent abstraction an interface or class.

2)can the wait() method of the threads be overridden?if so why?

No they can't since they are declared final.

3)what exactly is a reference.? eg:- Graphics g

A reference is a pointer to an object. Although java has no direct access to pointer but that's what exactally a reference is.

5:06 AM  
Anonymous Gurumurthy said...

1) a difference between abstract class and interface..

a. Interfaces:
i. for implementing multi-level inheritance
ii. All members should be public
iii. Should not have any implementation.

b. Abstract Class:
i. For capturing general behaviour
ii. You can have partially implemented methods.
iii. You can have all access modifiers like private, public, protected

10:07 PM  
Anonymous scottaedwards said...

NOW, check this out for FREE...

There is a new, fully automated traffic-generation system that can send 1000's of targeted prospects to your website, for FREE! It only takes 5 minutes to set up to set your FREE account!

To find out more visit: multi level marketing site. It successfully exposes FREE information covering Traffic and multi level marketing related stuff.

3:23 PM  
Anonymous scottaedwards said...

NOW, check this out for FREE...

There is a new, fully automated traffic-generation system that can send 1000's of targeted prospects to your website, for FREE! It only takes 5 minutes to set up to set your FREE account!

To find out more visit: mlm business site. It successfully exposes FREE information covering Traffic and mlm business related stuff.

3:28 PM  
Anonymous scott edwards said...

Congradulations on your blog! NOW, check this out, You can join a program that starts at only $7 then the costs go down. Down, Down, Down. It only takes 5 minutes to set up your international account!

To find out more visit: multi level methods site. It successfully exposes FREE information and covers multi level methods related stuff.

7:06 PM  
Anonymous scott edwards said...

As a special token of my appreciation for all your kind help and the wonderful business you have sent my way---I want to give you a free gift.
It is called the "$25000.00 Idea". It will help you in all your endeavors.
Click here: FREE GIFT

3:04 PM  
Anonymous multi level marketing said...

Dreamjava,

Are you interested in some
free advertising for your blog on mlm?
You are welcome place your link on our site for free.
See mlm or http://www.leadcub.net. We have a specific
category for mlm. Good luck.

John

Get 10,000 free opt in leads right now.

5:11 AM  
Anonymous Anonymous said...

where can i be able to download the pdf for 'head first java' book

3:42 AM  
Blogger Bhavya said...

A good attempt by Abhinav Anand.

Just wanted to add :
When we talk off references, its almost like pointers in C.
References reside on the Stack and its objects on the heap.

1:40 AM  
Anonymous Anonymous said...

abstract class is that class in which some functions are declared only and some have defination also with declaration.
whereas interface is 100% abstract class means only declaration is given.

1:37 AM  
Blogger Bond said...

a WELL EXPLAINED SOLUTION AT http://sunjavasnips.blogspot.com/

2:26 AM  

Post a Comment

<< Home