The difference between class, instances and object?

I've been reading a JAVA book and i've come accross terms such as class, instances and object. What I don't understand is why after creating a class, we have to create an object and then create instances? What's an object and instance anyway? I don't really understand the term. Can anyone pls help and explain it to me in an easier way to understand?
Thanks a lot.

A Class defines what attributes (properties) and methods a particular item will have.
Ex. You have a class person
public class Person
public void walk()
String name;
int age;
}An instance and Object are the same. When you create an instance of a class, you get an object of that class.
Person kevonline = new Person();You can then set kev's name, age, make him walk, etc... since these are defined in the class Person.
HTH,
Dewang

Similar Messages

  • What is the difference between function groups and Object Orientation

    Hello all
    I have read about this on the help.sap.com site, I still do not understand it completely, can some one explain me with  a simple example please ? (Not the increment counter example please !).
    Thanks a ton.
    Rgds
    Sameer

    Hello Sameer
    When you call a module of a function group for the first time in your program then the entire function group is loaded. However, this can happen only once within your report and all global variables within the function group will have the same values all the time (except they are manipulated via fm's).
    In contrast, you can create as many instances of the same class as you want and all of them can have different global attributes. And all these instances are independent of each other.
    On the other hand, if fm_A changes global attributes of the function group and fm_B reads these attributes then fm_B read the changed values.
    Or in other words:
    Function Group = can be instantiated only ONCE
    Class = can be instantiated unlimited
    Regards
      Uwe

  • Difference Between central instance And application instance

    Hi every body can any one tell me that
    what is the difference between Central instance and Application instance.
    If i am using 4.7 ee with orcale data base.

    Check these links
    http://oreilly.com/catalog/sapadm/chapter/ch01.html
    Basically these terms comes when you are working on live servers where all the users log into to do their daily work.
    We says when we want to distribute the workload on servers we requires central instance and application servers.
    Normally it is not known to common users where they are logging into...but they can login directly usign the specific Instance details of servers.
    Please see this also
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a64e8505211d189550000e829fbbd/frameset.htm

  • Difference between v$instance and v$thread

    Hallo,
    What is the difference between v$instance and v$thread?
    Thanks,

    Well, a mere description of the views in the official documentation isn't going to actually help you very much more than you could do with a simple "desc V$instance/desc V$thread", I suspect.
    The answer I think you might be looking for is that a thread is not the same thing as an instance. In fact, we usually talk about "a thread of redo", which gets much closer to the issue here. Yes, it is true that one instance can only generate one 'thread of redo', so one instance = one thread, and there's a temptation to extrapolate from that and assume they're the same thing.
    But they're not. An instance is a set of memory structures and processes. It has a name. It gets started and stopped. In can be running in various states (nomount, mount, open, read-only, primary, secondary etc).
    A thread of redo is a history of redo generated by an instance. It has ever-incrementing checkpoint change numbers, times of last checkpoints, sequence numbers, blocks of redo that are forever being flushed to different parts of the current redo log. And so on.
    Thus, V$INSTANCE tells you the state of the instance and V$THREAD tells you all you could ever want to know about where you're up to in the writing-redo stakes.

  • Difference between busniess Event and object event

    Hi All,
    Can anyone explain to me what the difference between business event and object event in Beehive?
    thanks

    Business events are events that are exposed for integration with policies, audit, workflows, user notifications etc.
    Object events are an internal-to-beehive system service that are consumed within Beehive Services and are not exposed for application or user consumption.
    Richard

  • What's the difference between a not-initialed object and a null object

    hi guys, i wanna know the difference between a not-initialed object and a null object.
    for eg.
    Car c1;
    Car c2 = null;after the 2 lines , 2 Car obj-referance have been created, but no Car obj.
    1.so c2 is not refering to any object, so where do we put the null?in the heap?
    2.as no c2 is not refering to any object, what's the difference between c2 and c1?
    3.and where we store the difference-information?in the heap?

    For local variables you can't have "Car c1;" the compiler will complain.That's not true. It will only complain if you try to use it without initializing it.
    You can have (never used, so compiler doesn't care):
    public void doSomething()
       Car c1;
       System.out.println("Hello");
    }or you can have (definitely initialized, so doesn't have to be initialized where declared):
    public void doSomething(boolean goldClubMember)
       Car c1;
       if (goldClubMember)
           c1 = new Car("Lexus");
       else
           c1 = new Car("Kia");
       System.out.println("You can rent a " + c1.getMake());
    }

  • Whats the difference between an INTERFACE and a CLASS?

    Whats the difference between an INTERFACE and a CLASS?
    Please help.
    Thanx.

    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=Difference+between+interface+and+class

  • In TCA, what is the difference between Item instance owner and System's own

    Hi,
    In TCA, what is the difference between Item instance owner and System's owner ?
    thanks
    siva

    ...can i make as many iweb websites as i want? ...and as many blogs as i want? ...i have never made one before....
    ....although, i do have my own small business and i do have a website that i paid a guy to make and also host....(which is a waste of $$$$ in my opinion as i think i can do a better job making one myself through iweb) ....
    ...anyways, i know it is splitting hairs but what exactly is the diff b/w a blog and a website ....i am under the impression that a blog is just a personal newsletter sort of thing,...?

  • Can Anybody explain me the difference between  a Bapi and a webservice?

    Can Anybody explain me the difference between  a Bapi and a webservice?

    Hi Anil,
    <b>BAPI</b>
    BAPI is a library of functions that are released to the public
    as an interface into an existing SAP system from an external
    system.A BAPI function is a function module that
    can be called remotely using the RFC technology
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.
    In this case you only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI. It is not possible to connect SAP to Non-SAP systems to retrieve data using RFC alone. RFC can acces the SAP from outside only through BAPI and same is for vice versa access.
    <b>Webservice</b>
    In simpler terms, WebService is an application on the Web/Internet. Wheneever Service is requested by the user, it provides the service (i.e Request/Response)
    A web service is a collection of protocols and standards used for exchanging data between applications or systems
    In SAP world, we can expose an application into the Webservice. For e.g We can expose ABAP programs into Webservice.
    XI uses SOAP adapter to communicate with webservices see below...why only soap adpater???
    -> Some remote clients or Web services providers are only able to communicate by means of SOAP messages
    ->SOAP adapter enables you to exchange SOAP message between remote clients and Web Service Servers and the Integration Server.
    -> The SOAP Adapter provides a runtime environment that includes various SOAP components for the processing of SOAP message.
    -> You use the SOAP adapter to connect such systems to the Integration Server directly
    -> The SOAP adapter uses a helper class to instantiate and control these SOAP components
    ->The SOAP adapter receives a msg from the remote client or Web service provider, converts the SOAP protocol into XI msg protocol and then sends the msg to the Integration Server to be processed further.
    Basically  RFCs BAPI are all SAP oriented, Webservices are language / environement independent. So, all one has to do is publish a Webservice and any external system by providing the data in the correct format, can get the approopriate response back.
    see these links to know more abt webservices..
    http://www.webservices.org/
    http://www.w3.org/2002/ws/
    regards
    biplab

  • Difference between Database, instance and schema

    Hi
    I don't know the clear difference between database, instance and schema.. In the broad sense, everything seems to be the same. If anyone can differentiate between them with some example, that will be of great help.
    Thank you.

    Hi,
    In Oracle, people often do use "database" and "instance" interchangeably, or together as one term: "database instance".
    A "schema" is quite different. A schema is a collection of objects (such as tables, indexes or procedures). Every object belongs to exactly one schema, and every schema is a part of exactly one database. (Names may not be unique, however. For example, your database may have one schema named SCOTT, and another schema named USER1. Each of those schemas may have a table named EMP. The EMP table in the SCOTT schema, or SCOTT.EMP, is not the same as the EMP table in the USER1 schema, or USER1.EMP. A different database, my database for example, may also have schemas called SCOTT and USER1, which are completely independent of the SCOTT and USER1 in your database.)

  • What is the difference between jsp :include and server side include

    what is the difference between jsp :include and server side include(request dispatcher include method)????
    i understand that both request dispatcher include method and jsp:include take dynamic data,so when would one use request dispatcher include and when jsp:include.
    Is the usage interchangeable?i believe jsp include is used only for jsp/html but include directive can be used to include servlets ,jsp and html....correct me if i m wrong and
    do suggest if u hav ny other diff in this context...

    The difference really is: in what format do you want your inclusions? If your environment has many Java developers and only a few designers that focus mainly on, say, Flash, that might push you more towards the server-side include() directive. Or, if you have a large set of pages that receive dynamic content that is displayed in a consistent fashion (such as a workflow header area on a page).
    If, on the other hand, you have more web designers, there may be a greater desire to deal in markup rather than Java code. Java developers themselves might prefer to view markup (JSP) that more resembles the eventual output than something occuring in Java code.
    Finally, there are considerations of tiering. While it is totally possible to (and I have previously) implement 'view classes' that render markup or generate layout templates, JSP's offer, IMO, a subtle, psychological advantage. By forcing a developer to work in a different format, markup versus Java source, the separation on view from controller and model becomes a bit easier. It is still possible to make mistakes, but if a developer at some point notices, "Wait, I'm in a JSP, should I be importing a java.sql class?", then the choice to use JSP includes has paid off in spades.
    - Saish

  • Whats the difference between arrayCollection = null and arrayCollection.removeAll()?

    Whats the difference between arrayCollection = null and
    arrayCollection.removeAll()?

    In arrayCollection = null; statement you're setting this
    reference to null and potentially making it available for garbage
    collection. I say 'this reference' and potentially because, as you
    may know, there might be other references to this array collection
    object that won't be affected by this statement and hence it won't
    be GC'ed.
    arrayCollection.removeAll() says that I want to empty this
    array collection for all the reference that we pointing to it. That
    is, remove all the objects from the collection -- and of course
    make them 'potentially' available for the GC -- the size of the
    array collection would be reduced down to zero and all the
    references would be pointing to a valid but empty collection.
    Hope this helps.
    ATTA

  • What is the difference between delivery date and actual goods issue date?

    Hi ,
    Can you please tell me the difference between Delivery date and Actual goods issue date ?
    Delivery data can be be greater than goods issue date?
    Thanks,
    Ajay

    Hi Ajay,
                  Delivery date means its the original date on which the delivery should be done.Actual goods Issue date is the date on which goods to be delivered according to the purchase order.There can be delay in the delivery so we maintain 2 objects.
    Yes delivery date can be greater than Goods Issue date.
    Hope this clears
    Regards
    Karthik

  • The difference between FIELD-SYMBOL and normal DATA TYPE

    Dear experts,
    Please see the example below, both are output the same result.
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N,
          ENTRY TYPE STRING.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      MOVE EXTERNAL_RECORD+POSITION(LENGTH) TO ENTRY.
      WRITE ENTRY.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    --OR It can be written as--
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N.
    FIELD-SYMBOLS <ENTRY>.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO <ENTRY>.
      WRITE <ENTRY>.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    Is there any special circumstances we need to use FIELD-SYMBOL?
    Why is FIELD-SYMBOL is introduce in the first place?
    Kindly advice with example.
    Thanks in advance for those who can help me on this.

    HI,
    You can use field symbols to make the program more dynamic. In this example the name of a table control is substituted by a field symbol. Thus you cal call the form with any internal table, using the name of the table control as a parameter.
    Example
    form insert_row
    using p_tc_name.
    field-symbols <tc> type cxtab_control. "Table control
    assign (p_tc_name) to <tc>.
    insert 100 lines in table control
    <tc>-lines = 100.
    Field symbols allow you to:
    **     Assign an alias to a data object(for example, a shortened
            name for data objects structured through several hierarchies
            - <fs>-f instead of rec1-rec2-rec3-f)
    **     Set the offset and length for a string variably at runtime
    **     Set a pointer to a data object that you determine at runtime (dynamic ASSIGN)
    **     Adopt or change the type of a field dynamically at runtime
    **     Access components of a structure
    **     (from Release 4.5A) Point to lines of an internal table
            (process internal tables without a separate work area)
    Field symbols in ABAP are similar to pointers in other programming
    languages. However, pointers (as used in PASCAL or C) differ from ABAP
    field symbols in their reference syntax.
    The statement ASSIGN f to <fs> assigns the field f to field
    symbol <fs>. The field symbol <fs> then "points" to the
    contents of field f at runtime. This means that all changes to the
    contents of f are visible in <fs> and vice versa. You declare
    the field symbol <fs> using the statement FIELD-SYMBOLS: <fs>.
    Reference syntax
    Programming languages such as PASCAL and C use a dereferencing symbol
    to indicate the difference between a reference and the object to which
    it refers; so PASCAL would use p^ for a pointer instead of p, C would
    use *p instead of p. ABAP does not have any such dereferencing symbol.
    **     In PASCAL or C, if you assign a pointer p1 to a pointer p2,
    you force p1 to point to the object to which p2 refers (reference semantics).
    **     In ABAP, if you assign a field symbol <fs1> to a field
    symbol <fs2>, <fs1> takes the value of the data object to
    which <fs2> refers (value semantics).
    **     Field symbols in ABAP are always dereferenced, that is,
    they always access the referenced data object. If you want to
    change the reference yourself in ABAP, you can use the ASSIGN statement
    to assign field symbol <fs1> to field symbol <fs2>.
    Using field symbols
    You declare field symbols using the FIELD-SYMBOLS statement.
    They may be declared either with or without a specific type.
    At runtime you assign a field to the field symbol using the ASSIGN
    statement. All of the operations on the field symbol act on the field
    assigned to it.
    When you assign a field to an untyped field symbol, the field symbol
    adopts the type of the field. If, on the other hand, you want to assign
    a field to a typed field symbol, the type of the field and that of the
    field symbol must be compatible.
    A field symbol can point to any data object and from Release 4.5A,
    they can also point to lines of internal tables.
    The brackets (<>) are part of the syntax.
    Use the expression <fs> IS ASSIGNED to find out whether the field
    symbol <fs> is assigned to a field.
    The statement UNASSIGN <fs> sets the field symbol <fs> so
    that it points to nothing. The logical expression <fs>
    IS ASSIGNED is then false. The corresponding negative expression
    is IF NOT <fs> IS ASSIGNED.
    An unassigned field symbol <fs> behaves as a constant with
    type C(1) and initial value SPACE.
    MOVE <fs>
    TO dest     Transfers the initial value SPACE to the variable dest
    MOVE 'A' to <fs>     
    Not possible, since <fs> is a constant
    (runtime error).
    To lift a type restriction, use the CASTING addition in the
    ASSIGN statement. The data object is then interpreted as though
    it had the data type of the field symbol. You can also do this
    with untyped field symbols using the CASTING TYPE <type> addition.
    The danger with pointers is that they may point to invalid areas.
    This danger is not so acute in ABAP, because the language does not
    use address arithmetic (for example, in other languages, pointer p
    might point to address 1024. After the statement p = p + 10, it would
    point to the address 1034). However, the danger does still exist, and
    memory protection violations lead to runtime errors.
    A pointer in ABAP may not point beyond a segment boundary. ABAP does
    not have one large address space, but rather a set of segments.
    Each of the following has its own segment:
    *     All global data
    *     All local data
    *     Each table work area (TABLES)
    *     Each COMMON PART
    You should only let field symbols move within an elementary field or
    structure where ABAP allows you to assign both within the global data
    and beyond a field boundary.
    Rgds
    Umakanth

  • What's the difference between transport route and transport layer

    what's the difference between transport route and transport layer,Can somebody give me some explaination? thks in advance!

    Hi,
    Transport Layer in ABAP Workbench
        The Change and Transport System supports the distribution of development
        work on large projects across multiple SAP Systems.
        The packages in each development system are grouped into one transport
        layer.
        The transport layer determines whether objects are assigned to a local
        or transportable change request.
    Use
        Each of your SAP development systems is assigned a transport layer as
        its standard transport layer. If you use Extended Transport Control, you
        can assign different standard transport layers to certain clients.
        You can define at the most one consolidation target for each SAP System
    and transport layer.
    When you create a package, it is assigned the standard transport layer
    of the SAP System.
    If you want to assign a different transport layer to a package, you
    require the administration authorization for the Change and Transport
    System.
    The objects in a package automatically have the transport attributes
    defined for the corresponding transport layer.
    o   If a consolidation route originating in their SAP System is defined,
         then the objects are assigned to a transportable request, and
         transported into the consolidation target when it is released.
    o   If a consolidation route is not defined, the objects are assigned to
         a local request, and are not transported.
    Customizing settings are not assigned to a package. They have the
    transport attributes of the standard transport layer of the system or
    client.
    It is best to assign a package a standard transport layer for which a
    consolidation route originating in the development system is defined.
    To display and maintain the transport layers and routes, use the
    Transport Management System (transaction STMS).
    Only the system adminstrator can make changes.
    Caution:
         The tables TSYST, DEVL, TWSYS, TASYS are no longer productive as of
         Release 4.0A and cannot be maintained.
    Regards
    Ben

Maybe you are looking for