Monday 3 November 2014

Objects in java

  • Object may be defined as real time entity or run time entity.
  • An object is an instance or variable of type class.
  • Using objects, we can access the functions and variables of the class.
  • Every object can have data and functions.
Creating objects:
              Syntax:  class_name obj_name=new class_name();
              Example: Program p=new Program();
where Program is the name of the class and p is object.

If the function is declared as static,it can be accessed without using an object

No comments:

Post a Comment