| Author |
real time example for inner class and static inner classes.
|
pardhava krishna
Greenhorn
Joined: Feb 25, 2009
Posts: 5
|
|
Hello,
Can you please let me know when we choose inner classes over normal classes.And even when we opt for static inner classes with some real time example.This will help me a lot.
Regards,
Pardhu
|
 |
akhter wahab
Ranch Hand
Joined: Mar 02, 2009
Posts: 151
|
|
|
this might help you webpage
|
Start Earning Online||Start Earning Using Java
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16692
|
|
Also, I assume that you mean "real life" example, and not "real time" example. As a real time example would probably refer to an example using real-time java.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
pardhava krishna
Greenhorn
Joined: Feb 25, 2009
Posts: 5
|
|
Thanks of the prompt response.
yes i would mean situation or a requirement where do we go for inner classes.
Regards,
Pardhu
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
|
How about a LinkedList and Node inside a LinkedList. You can have the Node as a private inner class of the LinkedList class.
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Henry Wong wrote:
Also, I assume that you mean "real life" example, and not "real time" example. As a real time example would probably refer to an example using real-time java.
Henry
Henry, could you please give a good book on real - time java?
|
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
|
What do you think real-time actually means?
|
 |
pardhava krishna
Greenhorn
Joined: Feb 25, 2009
Posts: 5
|
|
Sorry if I am confusing you with the word real-time.actually i would like to know where we go for inner classes with out a seperate class,with an example. What are the disadvantages if we choose seperate classes instead of inner classes in that example .
Regards,
Pardhu
|
 |
Vinoth Kumar Kannan
Ranch Hand
Joined: Aug 19, 2009
Posts: 276
|
|
I've to at times felt that..whatever you do with an inner class, you can very well do with a separate final class(so that no one else inherits and uses it) and instantiate it inside your class.
Is there any other situation where we are forced to create an inner class(i think, this is what pardhava krishna meant by real-time), rather than a separate class outside?
|
OCPJP 6
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
http://download-llnw.oracle.com/javase/tutorial/java/javaOO/nested.html
look at the sub-headline *Why Use Nested Classes?*
<edit>
the good example is *LinkedList* source code as campbell mentioned.
</edit>
hth
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
|
Real-time means happening at the same time, so a real-time program must respond immediately to any input. Real-time programs are often used for controlling machinery, where for example the power must be turned on and off at exactly the right time.
|
 |
pardhava krishna
Greenhorn
Joined: Feb 25, 2009
Posts: 5
|
|
Yes ,What Ranch Hand is asking was my actual question.
Regards,
Pardhu
|
 |
akhter wahab
Ranch Hand
Joined: Mar 02, 2009
Posts: 151
|
|
thanks Campbell this example makes my concept strong too
|
 |
 |
|
|
subject: real time example for inner class and static inner classes.
|
|
|