Results 1 to 6 of 6

Thread: Differents between object and static object

  1. #1
    Join Date
    Dec 2009
    Posts
    41

    Differents between object and static object

    Hi Friends,

    I am java beginner with lots of confusion about the objects. I am confused between object and static object. According to my knowledge objects are nothing but the instance of class. But the objects and static objects are toe different concept. Please let know some differences between the Static object and object. I am waiting for your reply.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    Re: Differents between object and static object

    Hi,

    An object can be declared with static storage class using the static or extern keyword. Local objects must be explicitly declared as static or extern to have static storage class.Static object is an object is which doesn't work on ordinary methods.All global objects (objects declared outside all functions) have static storage class. You cannot declare static instances in a tiny-model program.

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    Re: Differents between object and static object

    Static object is an object is which doesn't work on ordinary methods. An object can be declared with static storage class using the static or extern keyword. one more thing to note static method can only able to acess static variables. Local objects must be explicitly declared as static or extern to have static storage class. All global objects have static storage class. You cannot declare static instances in a tiny-model program.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    Re: Differents between object and static object

    Software objects are conceptually similar to real-world objects. If any object is declared as STATIC. It shares the Memory space for the instances of that object.but in the case of simple object The separate memory space will b created for each instances. An object stores its state in fields and exposes its behavior through methods. An object is made from a class; a class is the blueprint for the object. An object stores its state in fields and exposes its behavior through methods.

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    Re: Differents between object and static object

    When a static object is declared with an initializer that does not evaluate to a constant expression, the object is given the value 'zero' at the point before execution enters the block for the first time. Local objects declared as static are initialized the first time their declarations are encountered in the program flow. However, the object is not visible and no constructors are called until the actual point of declaration.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,394

    Re: Differents between object and static object

    There are many different kinds of Java Objects, and in fact a big part of programming in Java is creating your own types of Objects. Object is an instance of a class. Methods operate on an internal state of the object and serve as the primary concept for the object-to-object communication. To create a new type of object that you can use in your Java programs, you have to provide a blueprint of sorts that Java will use to create new Objects of this type. This blueprint is called a Java class.

Similar Threads

  1. Replies: 6
    Last Post: 06-06-2011, 01:34 AM
  2. Replies: 3
    Last Post: 08-01-2011, 05:20 AM
  3. static methods in object oriented programming
    By Satchel in forum Software Development
    Replies: 5
    Last Post: 07-01-2011, 08:58 PM
  4. Object reference not set to an instance of an object
    By KAIRU26 in forum Software Development
    Replies: 3
    Last Post: 05-09-2009, 08:14 PM
  5. Object test = new Object() <-- Java, best way in C++
    By ADISH in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •