Thursday, 9 July 2015

JAVA Basics

JAVA Basics:-

 Class:-
         Class is a blueprint of an object that contains variables for storing
          Data and functions to performing operations on these data. Class
          will not occupy any memory space and hence it is only
          logical representation of data.

Object:-
               Objects are the basic run-time entities in an object oriented system.
           Object is instance of Class .
          "Object is a Software bundle of related variable and methods."

          

DO you think that only definition is sufficient for understanding the anything? I think No.
then now we should come to think about Class and Object.
Just think about a Alien.And suddenly you see a Alien.Here i want to say that Class is only logical thing BUT object logical as well as physical both.Object occupy space.

2 comments:

  1. then object require memory? if yes how many.

    ReplyDelete
  2. Hi Nikhil,
    your ans is here,sry for late reply
    a normal object requires 8 bytes of space;
    arrays require 12 bytes (the same as a normal object, plus 4 bytes for the array length).

    If any doubt ask more question,

    Thanks for asking question.

    ReplyDelete