Monday 24 November 2014

Beginning Programming
Object Oriented Programming 
We write computer programs to solve problems and there are several programming paradigms. Object oriented programming is a popular, widely used and common one. Java is an object oriented programming language. In object oriented programming, we solve a problem by defining objects that interact with each other. This is an intuitive way to model real world problems since we see objects all around in the real world - cars, stars, flowers, rooms etc. An object oriented language therefore provides us with a mechanism to
  1. Define the behavior and properties of objects we want to define
  2. Set up objects of each kind and put them to work
Most object oriented languages including Java allow programmers to create classes to address the first point. A class is a template or blueprint to create objects. It  lets us define state and behavior for objects and allows us to create objects of that class.
  • State is defined by internal data - in Object Oriented terminology these are referred to as fields or attributes
  • Behaviour is determined by methods that we write to implement logic
  • New objects can be created using constructors
Java allows us to write code to create classes and define fields, methods and constructors.

No comments:

Post a Comment