What are advantages of inner class
Answered by: ssalguti
Member Since Apr-2008 | Answered On : Apr 25th, 2008
Logical grouping of classes—If a class is useful to only one other class, then it is logical to embed it in that class and keep the two together. Nesting such "helper classes" makes their package more streamlined.
Increased encapsulation—Consider two top-level classes, A and B, where B needs access to members of A that would otherwise be declared private. By hiding class B within class A, A's members can be declared private and B can access them. In addition, B itself can be hidden from the outside world.
More readable, maintainable code—Nesting small classes within top-level classes places the code closer to where it is used.
Defining a class within another class is known as nested class.
If class B is defined within class A, then B is known to A, but not outside of A.
Class B has access to the members, including private members of the Class A.
However,the class A does not have access to the members of Class B.
Logical grouping of classes—If a class is useful to only one other class, then it is logical to embed it in that class and keep the two together. Nesting such "helper classes" makes th...
A monolithic object is an object that has no externally-discernible structure. Said another way, a monolithic object does not appear to have been constructed from two or more other objects. Spec...
Aggregation differs from ordinary composition in that it does not imply ownership. In composition, when the owning object is destroyed, so are the contained objects. In aggregation, this is not necess...
What is run time polymorpism and complie time polymmorpism
I think siva got it correct. There is no such thing exists as compile time polymorphism.Unless otherwise you run a program how does it (JRE) actually know, what to do? I mean without executing the pro...
Hi every body
Overloading is Compile time Polymorphism
Overriding is Run time Polymorphism
Please dont confuse everything
Mail me for any questions and my id is sv.vgayathri@gmail.com
The concept of Serializable is that we can recreate the state of an object from a permanent source like a file, xml etc.Example: I had personally implemented used in scenario where i had an organizati...
When the object supposed to be sent across the network serializing technique makes sure the data is not lost in case of network failure. Seralizaing is converting the object to its byte code form and then sending it accross the network.
How the abstract classes in cmp are converted into concrete classes?
By extending the abstract class by other class and creating object to that class
I want to maintain our LAN through JAVA can U help me ?
What is the need of an abstract class?
If I write all of concrete methods in one class and all abstract methods in an interface and extend and implement both in third class assume that third class don't extend any other class?
Abstract is most useful when you are creating a framework..take the example of template method pattern which is used in the templates provided by spring framework for the support of jdbc or hibernate...
If we have some method which body is not defined till declartion of class and body is implemented in subclass later then declare that class as abstract class.If a class has atlest one abstract method then we have to declare class as abstract class
2. A system of Objects that are build using each other
1.A system of objects that implement each other
How can I call a funtion,given its name as string?
Class clsObj = Class.forName("ClassName");
Method method = clsObj.getMethod("methodName",null);
method.invoke(clsObj.newInstance(),null);
we can also call the method using Introspection API, Eclipse uses this API to get the name of all the methods available in a class after we enter "." after a Class Instance or Class Name for static methods;
Why in case of Java header file name is not required ?
here we are using package
hi friends java having a classes and packeges so no need to header file in java. so header file is not required. by...
in unicode all character availbale in the world has been assign with a unique number that is for internationalization
What is Unicode? Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter w...
What is diff between union / union all
Union dosent allow duplicate value
Union all allows duplicate value
UNION does it will not allows duplicate value, where as UNION ALL allows the duplicate values.
A class which is define inside a class is known as inner class inner class can be static but top level class can not be static.
What is the difference between unicode and hash code?
Unicode is used for globlization ie its support all languages its use for globlization where as hash code is a unique number which is given to object by JVM .hash code is implement by some...
equal objects should have the same hashcode ...
i.e when u go for overridding a equal() method , u should override hashcode() also
Java archive is the collection of builtinn or user define packages(.class file)
Friends i have a small doubt ...
i heard that Jar will supported by all platforms and Zip wont suport
is it true ?
How to connect the crystal reports to the JSP applications
Hi,
Pls go the below link, you will get the solution for your problem
http://support.businessobjects.com/communityCS/FilesAndUpdates/bexi_jsp_samples.zip.asp
Thanks and Regards,
Senthil C.R.
Inner classes can also access method parameters that are declared to be final.
From www.javaranch.com:The inner class can't use local variables from the method in which the inner class is defined! After all, at the end of that method, the local variables will be blown away. Poof...
What are the three steps to deploy ejb?
Hi,
The final step should be to deploy deployable jar.
With Best Regards
-ashruf
1.Adjust Deployment Descriptors
2.Perform Server-Specific Configuration
3.Generate Container-Specific Classes
Run-time polymorphism provides the ability to use late-binding. In other words, the function called or the data member accessed is not determined until run-time and is based on the type that a v...
Purpose of Runtime polymorphism:Run time polymorphism is a mechanism by which a call to overriden function is resolved at runtime rather than compile time.For e.gIf (user clicks link 1) then{obj1.over...