Which one is better static inner classes or inheritance ?

Hi,
Consider following scenario,
Class A does some database related work and Class B,C,D has more specific tasks for specific databases. For now B,C,D has more static information like driver name etc.
1. I can either make class B,C,D as static inner classes OR
2. classes B,C,D can extend class A.
Case 1. makes it more flexible, if in future, B,C,D needs more than static methods.
Case 2. can avoid complexity and cost of instantiating differnt objects based on differnt scenarios.
Which approache is better in both ?
Thanks

Yes, I have seen abstract factory pattern , rather I have implemeted it at one place and in case 1. using abstract factory pattern is the way to initialize all classes.But my question is if I make all subclasses as a static inner classes, will it be better or efficient approach as compare to abstract factory pattern.Because Abstract factory patter adds more complications in code in turn it provides more flexibility.

Similar Messages

  • I am going to buy a macbook pro for grade 12, and I need to know wheather I should get a macbook pro or a macbook pro retina. If someone could tell me (in a very simple way) which one is,better for me and why, I would be ever so apprreciative.

    I am going to buy a macbook pro for grade 12, and I need to know wheather I should get a macbook pro or a macbook pro retina. If someone could tell me (in a very simple way) which one is,better for me and why, I would be ever so apprreciative.

    Why do you need a expensive MacBook Pro?
    Your attending high school and unless everyone else is rich also your likely going to be a target by the more poorer students for theft or damage to the machine.
    You could keep it home, but if you need it for class then your exposed again.
    Also at that age your not very careful yet, a MacBook Pro is a expensive and easily damaged machine.
    Unless your made of money and so are others at your school, I would recommned a low profile, just does the job cheap Windows PC.
    If it dies, gets lost, stolen or damaged because of your inexperince handling senstivie electronics then it's no big deal.
    You can buy a Mac later on when your sure you have a need for it, currently there isn't much advantage of owning a Mac compared to a PC, they do just about the same things now, one just looks prettier than the other.
    Since 95% of the world uses Windows PC's your going to have to install Windows on the Mac in order to keep your skills up there or be unemployed, so it's a extra headache and expense.
    good luck

  • Static inner class causes deployment  on OC4J 10.1.2 to fail

    Hi,
    this issue has already been raised on OC4J 9.0.4 with J2SDK 1.4.2 (see EJB fails to compile - static inner class problem
    Recap: When referencing static inner classes in an EJB, the deployment fails. During the generation of the wrapper classes, a signature <package>.<outer class>.<inner class> gets converted to <package>.<outer class>$<inner class>, which is syntactically wrong. While the Java 1.4.1 compiler kindly ignores this syntax error, its 1.4.2 counterpart complains - and fails.
    @Oracle: When will this bug be fixed for OC4J 10.1.2?
    Best regards,
    Holger

    Holger,
    Don't static inner classes contradict the EJB specification?
    In any case, in answer to Andy's question: If you wish to file this as a bug, you can do so via the MetaLink Web site.
    [In fact, [i]MetaLink is your only option for submitting bugs for Oracle products -- as far as I know.]
    Good Luck,
    Avi.

  • EJB fails to compile - static inner class problem

    I am using OC4J 9.0.4 and Sun JDK1.4.2 and EJBs fail to compile if they reference objects that contain static inner classes. However, they successfully compile under JDK1.4.1.
    For example, I have a class like below:
    public class ValueObject
    public static class Key
    private Key key;
    private String value;
    Any references to ValueObject.Key inside the EJB cause the EJB compiler to generate "ValueObject$Key" which is incorrect. JDK1.4.1 is more lenient than 1.4.2, and allows this error through.
    Is there a way around this problem other than reverting to JDK1.4.1?
    Regards,
    Andy

    The reason I don't want to move to JDK 1.4.1 is because of the memory leak in the StringBuffer.toString() method.
    Is there anywhere I can submit this as a bug?
    Regards,
    Andy

  • When  we going to use static inner class

    Hi
    when we r going use static inner class
    inner classes use for to create adaptorclasses that implement an interface.
    what about Static inner class
    if possible give some examples
    Thanks in adv

    static inner classes are used when the inner class does not require to access the encompassing class's variables/methods. By default non-static inner classes obtain a reference to the outer class instance through which they access the outer class variables and methods
    ram.

  • Which one is better null == object or object == null

    I am just surffing on a google and i found one new thing which is new concept to me, but that concept is not cleared
    Concept is, i found one place a class object is compaired with the null in following way
    if( null == object)
    Usually i used
    if(object == null)
    Problem :- What is the diffrance between these two condition and which one is better?

    yawmark wrote:
    corlettk wrote:
    So... Just use the first way (by default) because that's how people are it reading accustomed to.Agreed. Just to point out, the reason commonly given for preferring (null == object) is that it prevents semantic errors such as (object = null), which is only a problem in Java in a minuscule number of cases.And the practice started in C (or maybe even an earlier language) where it's an issue in many cases. For example,
    int i = 0;
    if (i = 1) { ... }The "if" line is illegal in Java, but it's legal in C. If the programmer forgets the second = sign, then you get the above. Variable i gets a value of 1, and the expression i = 1 has a value of 1, which corresponds to true (whereas in Java, you can't use an int where a boolean is expected). So the if comes out true, when it should have been false (had we properly used if (i == 1)), and in addition, the value of i has changed when we didn't want it to.
    In Java, this would be a compile-time error, whereas in C, it's a runtime error. Compile-time errors are easier to fix, and they don't get the opportunity to cause a problem after the software has been released.
    In C, to turn this back into a compile time error, you could get in the habit of writing if (1 == i) Then if you forget the second = sign, you get if (1 = i) which is a compile-time error.
    Because Java doesn't equate numerical zero with false and non-zero with true, this issue is, as yawmark demonstrates, much less of a problem in Java.

  • I am looking for macbookpro mid 2010 HDD exact specs so that i can upgrade it to 1TB. PLEASE HELP ME  about OEM apple brand or which one is better.Thanks

    I am looking for macbookpro mid 2010 HDD exact specs so that i can upgrade it to 1TB. PLEASE HELP ME  about OEM apple brand or which one is better?.Thanks

    clintonfrombirmingham Your information is not correct.
    http://kb.sandisk.com/app/answers/detail/a_id/8142/~/difference-between-sata-i,- sata-ii-and-sata-iii
    I have a sata II samsung 5400 rpm and i am only able to transfer at 85 read right speed.
    On my main drive sata III ocz agility 3 ssd i get 120 mb read and 180 write.
    Neither of these come close to the 300 mb promised. So it wont matter if he got sata II or III
    The speed came from Blackmagic Disk Speed Test

  • I would like to buy am Ipad for my nephew. Which one is better to play games, ipad or ipad mini

    I would like to buy an ipad for my nephew. Which one is better, ipad or ipad mini? He wants to play games, and put lots of app.

    Probably the full iPad, because it has a better graphics card. The larger screen helps too.

  • c:redirect VS RequestDispatcher -WHICH ONE IS BETTER TO USE?

    WHENVER WE WANT TO ACCESS FILES FROM OHTER APPLICATIONS,WHICH ONE IS BETTER TO USE,<c:redirect> OR
    RequestDispatcher

    Please stop shouting. It is considered rude.

  • , c:redirect OR RequestDispatcher -which one is better to use

    WHENVER WE WANT TO ACCESS FILES FROM OHTER APPLICATIONS,WHICH ONE IS BETTER TO USE,<c:redirect> OR
    RequestDispatcher

    <c:redirect> is the JSTL equivalent of the sendRedirect() method of javax.servlet.http.HttpServletResponse.
    Please see here:
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=405398 or search the forums for "RequestDispatcher redirect"

  • Shutdown or Sleep, which one is better??

    I usually use my Mac Mini about 3 hours a day. At the end of the day, should I shutdown the machine or simply put it in sleep mode? Which one is better? What is the difference?
    Mac Mini   Mac OS X (10.4.6)  

    791/3237
    Hi Snawman,
    I agree with the others. In your case, better shut it down for saving energy.
    "Which one is better? What is the difference?":
    - Sleep allows to very quickly resume any task that was running. Leave all applications, documents etc open, they'll just be here at the same place, in the same state, as when you left your computer.
    It's just a matter of quickly going back to work, not having to retype some websites login passwords for example, etc.
    - On the wear and tear point of view, the difference is so small, your Mini will be obsolete and replaced with a newer Mac, far before something breaks down just because of to many cold boots!
    Yes, the most demanding task for a computer's hardware (and probably OS too), is a cold boot.
    Sleep, instead of Shutdown, keeps your computer components from a lot of temperature fluctuations, and the hard disk too just spins down, instead of completely setting itself down, then up again from scratch (and cold).
    Again,
    these differences exist, but they are not so important that you would take them into account and change your energy saving habits.
    - Macs are well designed to cope with many different kinds of users/usages.
    "About running yourself the nightly automatic maintenance":
    In case you didn't know already about this: yes, just open Terminal and paste this command
    sudo periodic daily weekly monthly
    once or twice a month.
    In order to make sure all three maintenance tasks run until the end, after you entered your admin password and hit Return, just leave Terminal open like 15 minutes or so (until you see its prompt again).
    There is no hurry to quit it, as the maintenance runs in the background: Just use your computer in the meanwhile.
    Enjoy your Mac!
    Axl

  • How to use a static inner class?

    what's the implication of identifier "static" before an inner class.Thank you.

    not sure what implication is, due to my poor vocabulary. But here's an uuh... "example" of a static inner class:
    public class Example {
         static class AnotherClass {
    }There you have class "Example" with the static inner class "AnotherClass." If you wanted to use "AnotherClass" you would do something like:
    public class Whatever {
         Example.AnotherClass ac = new Example.AnotherClass();
    }I don't think I'm mistaken there, but if I am someone please correct me.

  • If i have two option to select between XI or BW which one in better and why

    if i have two option to select between XI or BW which one in better and why
    both in terms of money and in terms of my career growth.......

    Sheetika,
    XI if you  are good in JAVA.The rest is same for both XI and BW.
    K.Kiran.

  • For developer's point of view which one is better- 10g or 11g

    guys please help me out.
    let me konw from developer's point of view which one is better 11g or 10g.
    i want to apply for oracle.

    user9342767 wrote:
    guys please help me out.
    let me konw from developer's point of view which one is better 11g or 10g.
    i want to apply for oracle.Assuming you are talking about Oracle Database 10g and Oracle Database 11g, and not any of the other products that use the brands 10g and 11g (and assuming you want to discuss that here instead of the appropriate product forum where it belongs), here are some of my thoughts:
    - if you are not using any 11g features, nor any new-in-10g features that have been fixed in 11g, it does not matter;
    - if you are using 11g features, then 11g is the way to go;
    - if you want (or want your customers to have) regular support past July of this year, go 11g;
    - if you want the latest fixes in the optimizer, go 11g;
    - if you want to save yourself code by using database features, look at the docs and see whether they will help.

  • Which one is better EP with ABAP or EP with Java

    Hi Experts,
    Please tell me Which one is better EP with ABAP or EP with Java for learning and useful in USA?
    Regards
    Jana

    What programming background do you already have?  You should match up the flavor of Web Dynpro that matches the skill sets you already have?  Do you have ERP or other Business Suite experience already?  If so you will find that WDA is often used in conjunction with the Business Suite and WDJ used for composites.  So consider where your business domain experience and knowledge lies and support that as well.

Maybe you are looking for