What is the use of an abstact class?

Hi friends,
why we need to the abstract class...in which scenario????????
Thanks

ghostbust555 wrote:
THe abstract class is very useful because you can force people who extend a class to override a method.That does not do anything to explain the use of an abstract class.
For example when I was creating JavaPoint (sourceforge.net/projects/javapoint) I created an object called GraphicObject. It cotained code for different things related to drawing images and shapes on the screen. But the method to convert each GraphicObject to XML for saving was made abstract because each different type of GraphicObject (CircleGraphicObject, SquareGraphicObject ...) needed different code to turn it into XML. Thats just one example there are many many uses for it though.That almost kinda sorta explains the user of abstract classes.
@OP: The use of an abstract class is when you 1) want to define a type--that is, what some particular type can do, 2) want to allow different, independent implementations of that type, and 3) want to provide a reasonable default implementation for some of that type's operations.

Similar Messages

  • What are the uses of Void wrapper class?

    Hi,
    Similar to other Wrappers, Void is a wrapper class for the primitive ' void ' . We all know that Void is a final class , we can't instantiate it.
    My Question is what are the uses of Void?
    thanks,

    kajbj wrote:
    I have at times used it in reflection and jmx.I have used them with SwingWorker if I didn't have anything interesting to return. There is also an example in the tutorial: [http://java.sun.com/docs/books/tutorial/uiswing/concurrency/simple.html]

  • What are the uses of declaring a class "final"?

    Can any one please tell me the uses of declaring a class "final"?
    I know that final classes cannot be extended. Other than this,
    Is there any thing that will improve the compiler time for the final classes?

    compiler performance is utterly unimportant anyway...
    If the compiler takes too long, just get a faster build system :)

  • What is the use of have 3 Class loaders and why not only one

    In java we have 3 class loaders i.e BootStrap loader, Extension loader and System loader. Why can't we have just one?
    And what is the user of Extension loader?

    user7041221 wrote:
    In java we have 3 class loaders i.e BootStrap loader, Extension loader and System loader. Why can't we have just one?
    And what is the user of Extension loader?This has to do with one of the most advantages of OOP, reusability.
    First comes the Bootstrap class loader, it loads the classes contained in java.lang
    Next comes the Extention classloader, which loads vendor specific classes, like in case of SUN jvm the extention classloader will load the jars contained
    in /jre/lib/ext, that is why if you place any jar file in this directory, it will automatically be loaded at runtime. Suppose you place log4j.jar in this directory in this directory, now if you check the classpath[if you use eclipse, it is very easy to find out],log4j jar willl be there, you will now not have to explicitly add the jar in the classpath again. If any other vendor supplies JVM ,he/she will place their vendor specific classes in this directory.
    Last but not the least, the system classloader, it loads the classes in your application, example can be, when you use jdbc and do this :
    Class.forName("")
    system classloader is loading the class for you, there are two types: static and dynamic class loading.
    Now all these classloader follow the same rule, first it asks its parent classloader to load a class for it, system classloader will ask the extention classloader
    to load a class when needed, and if the extention classloader has already loaded the class, that class will not be loaded again. If the class could not be loaded by ext class loader, the the system classloader tries to load it. Relation between ext and bootstrap class loader is same. If the class not found ClassNotFoundException is thrown..
    For more details..check the specification.

  • Why class builder allows to develop abstract final class ? What is the use of such class in ABAP?

    I am new to ABAP. I tried creating abstract class and found that class builder allows development of abstract final class. What is the use of such class in ABAP?

    Hi,
    Does not compile:
    This one do:
    Inheritance:
    Regards.

  • What is the use of Generic class in java

    hi everyone,
    i want to know that
    what is the use of Generic class in java ?
    regards,
    dhruvang

    Simplistically...
    A method is a block of code that makes some Objects in the block of code abstract (those abstract Objects are the parameters of the method). This allows us to reuse the method passing in different Objects (arguments) each time.
    In a similar way, Generics allows us to take a Class and make some of the types in the class abstract. (These types are the type parameters of the class). This allows us to reuse the class, passing in different types each time we use it.
    We write type parameters (when we declare) and type arguments (when we use) inside < >.
    For example the List class has a Type Parameter which makes the type of the things in the list become abstract.
    A List<String> is a list of Strings, it has a method "void add(String)" and a method "String get(int)".
    A List<File> is a list of Files, it has a method "void add(File)" and a method "File get(int)".
    List is just one class (interface actually but don't worry about that), but we can specify different type arguments which means the methods use this abstract type rather than a fixed concrete type in their declarations.
    Why?
    You spend a little more effort describing your types (List<String> instead of just List), and as a benefit, you, and anyone else who reads your code, and the compiler (which also reads your code) know more accurately the types of things. Because more detail is known, the compiler is able to tell you when you screw up (as opposed to finding out at runtime). And people understand your code better.
    Once you get used to them, its a bit like the difference between black and white TV, and colour TV. When you see code that doesn't specify the type parameters, you just get the feeling that you are missing out on something. When I see an API with List as a return type or argument type, I think "List of what?". When I see List<String>, I know much more about that parameter or return type.
    Bruce

  • What is the use of valuation class in Finished Material Master?

    Dear Expert
    What is the use of valuation class in Finished Material Master?
    Thanks of Advance

    hi,
    this is to inform you that,
    generally 7920 - will be the valuation class for the finished goods.
    Allows the stock values of materials of the same material type to be posted to different G/L accounts & vice versa.
    this is an integration field which identifies the G/L accounts & goods movement types.
    balajia

  • What is the use of class Class

    What is the use of class Class?

    Sample use: if you are specifying the name of a class in a config file, you can use Class method newInstance to instantiate it.:
    String classname = ...
    Runnable r = (Runnable) Class.forName(classname).newInstance();
    r.run();

  • What is the use of Inner class.?

    hello everyone.........
    I want toknow that what is the use of Inner class...?

    Judging from what's seen around here? Mainly obfuscation.

  • What is the use of CVI_BDT_ADAPTER class ?

    Hi Freinds,
    what is the use of CVI_BDT_ADAPTER class ? can any one explain ?
    thnx n regards
    Vijaya

    Hi,
    This class is used for following cases:
    1.modify fields depending on customer status
    2.modify fields depending on vendor status
    3.to check user has the authorization
    to view/change/create data in the specified sales area

  • What is the use of Serializable Interface in java?

    Hello friends,
    I have one dout and i want to share with u guys:
    Why Serializable interface made and actully
    what's the use of it?
    At which place it become useful ?
    It is not contain any method then why it is made?
    If anyone have any idea about this then please reply.
    Thanks in advace
    Regards,
    Jitendra Parekh

    t is not contain any method then why it is made?To point out to the user of a class (and the programs) that the design of this class is conforming to certain restraints needed for Serialization.

  • What is the use of access level

    Hi Experts,
    What is the access level and what is use of each option in access level
    1  Application
    2  Superior component
    3. Top Component
    4. Sap
    5. Global
    and in Details section what is the use Properties tab
    1. Application Component
    2. Software Component
    3. Development Package
    4. Settings Class
    Please explain Each option use.
    Thank you in advance,
    Srini M.

    Hi Srini,
    just read the documentation (although the current status on SAP Help Portal isn't really up-to-date):
    1. [Entry point|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cc/85414842c8470bb19b53038c4b5259/frameset.htm]
    2. [Setting an Access Level|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/32/6aba9c49fd41a5a14f710e121220f1/content.htm]
    W/r to "Application Component" etc., docu on Help Portal is definitely not sufficient. Here, the following applies:
    An application offers attributes for the application component and the software component. The application component and software component have to be the same as defined for the development package. Application and software component are automatically derived from the development package if they are not set explicitly.
    For the definition of the development package, application component, and software component, we recommend that you choose the same values that are in effect for the software solution that you want to enhance by a new BRFplus application. This simplifies all activities related to the software infrastructure, especially transports.
    CU
    Claus

  • What is the use of XML file in EJB

    Hi,
    Generally EJB contains
    1) Home Interface
    2) Remote Interface
    3) Bean class
    4) XMl file
    In xml file we will mention something like
    <home>name of home interface </home>
    <remote?name of remote interface</remote>
    what is the use of this xml file and how it works.
    Thanks.

    It's called the deployment descriptor and it's used by the container to support your bean's configuration. For instance, if you want container managed persistence for an entity bean then you need to tell the container which table to use in which database with the column mappings, etc.

  • What is the use of properites file

    what is the use of properites file

    Hi there
    Usally a program has some variables that the user can set.
    These variables are then saved in a file.
    The Property class can read these files and search for special keys in that file for example
    Lets say that the program that you have developed
    can change its background color.
    the user sets the color to pink
    and the program stores the valu in the property file.
    then the property file entry could look like this
    color = pink
    On windows systems this is verry much like the ini files if you are familiar with these. (I think allmost any OS has something similair)
    In JDK 1.4 there is a new system for dealing with property files. This new class is storing the attributes directly to the register on the os
    /Markus

  • What is the exact mean of  classname.class.

    what is the exact mean of classname.class. what situations it will be use ful . how to use . give me one example .

    Each class, interface, or enum loaded into the JVM has an associated Class object. This contains a lot of information about the class in question, including lists of fields and methods. <classname>.class gives you a reference to the Class object of the class mentioned.
    See the java.lang.Class javadocs for all the things you can do with a Class object.
    For example:
    theImage = new ImageIcon(MainClass.class.getResource("item.png"));to retrieve an image file from the directory containing the MainClass class file.

Maybe you are looking for

  • Not able to get emails on iphone 5s

    Have been using my Iphone 5s for about a month now, and have discovered that as of last Friday at 4:30, I have not received an email on my phone, yet I have received many. I sent one on my phone to myself and I never got it on my phone. Please help.

  • Creation of maintainence order idoc

    Hi all How to create an outbound idoc for the maintainence order IW31 ? i have learnt we can use IORD tcode to create idoc for the maintainence order but i am not able to create idocs successfully with IORD? if anyone has used this tcode for creating

  • Making file desin with elements and attributes implementation

    hello this is an FILE to IDOC I have an xml file that need to be enter to the XI. the XML has attributes and elements. I would like to know how can I make an element with some attributes and below there should be a subelement. for example, in deliver

  • Bridge does not open files. dialog: libmmd.dll missing

    bridge does not open files. dialog: "libmmd.dll missing, reinstall bridge." Yet I cannot redownload bridge because when I open creative cloud I see bridge as up to date. How can I redownload installed programs?

  • Training for BPC

    Hello Fellows, I am a sales consultant positioning BPC at many places, furthermore, I am also planning to get training for BPC. I am pretty confused at the moment with the following queries in mind: Is BPC a technical (programming type) side of SAP?