Java and its concepts


Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

Java and its concepts

  1. 1.  Java is object oriented programming and it’s developed by sun Microsystems of USA in 1991. A first name of java is OAK then GREEN and last and finally renames its name and called java. As mentioned earlier object oriented is a term, now it is necessary to understand some of the concepts used extensively in object oriented programming. 1. Classes and objects 2. Inheritance 3. Polymorphism 4. Abstraction 5. Encapsulation 6. Dynamic binding
  2. 2.  class are user defined data type its contains data members and method and object are runtime entity and instance of class.  Each class is implementing in its own source file.  Name of the java file is the same as the class name.  Java application must include a class with a main method e.g.  public static void main (String args[]).  A class is not the same as the object that is made from it. A class is just like the blue print of the object, and the object is just like the product that is made by using the blueprint. For example car is a class but its category BMW, Maruti, Ford Figo is objects. CONTD………………….
  3. 3.  Inheritance is the process by which one object acquires the properties of another object. This is important because it supports the concept of hierarchical classification.
  4. 4.  Inheritance method in java class derived class name(B) extends base class (A) Example: Suppose take two java classes Class A contains 2 variables and ClassB Extends Class A that means here ClassB can access the classA variables without declaring it. If we do this then the memory will be less and reusable.
  5. 5.  polymorphism means the ability to take more than one form and its two type 1. Compile time polymorphism 2. Run time polymorphism Method overloading is an example for Compile time polymorphism and Method overriding is an example for Run time polymorphism
  6. 6.  Hiding unnecessary things and showing the essential information. Example: Suppose take a car: In that we will have breaks and steering and etc... Here when we are changing the gear box to up or bottom then gears will work but we don't know how they are managing internally and we don't no how it is working. As a driver we don't need to know how it is working internally when we are changing every time. That is the reason they will hide the wires and cables internally and they will show up only gear box to us.
  7. 7.  Wrapping up of data and methods into a single unit known as class and it’s the most striking feature of a class.
  8. 8.  Firstly we compile the programs (javac  Second we run the program (java hello).