navbar

Wednesday, 9 September 2020

INTRODUCTION TO JAVA

 

INTRODUCTION TO JAVA

Java is an Object oriented programming language develop in 1991 by James Gosling at that time it was called as Oak, but later in 1995 it was renamed as Java by Sun Microsystems.

Features of Java

  • Java is a simple language.
  • Java is a object oriented language (OOP).
  • Java is a robust and secure language.
  • Java is a sensitive language means upper and lower case treated differently.
  • Java is a platform independently language means write once and run anywhere.

 

Sample Java program…

Write a program to add two positive integer number.

class Num                             // created class name of Num                 

{

public static void main(String args[])     //then created main function

{

Int a = 5;                  // inserted integer in variable a

Int b = 8;                  // inserted integer in variable b

Int c = a + b;            // then add both integer in variable c

System.out.println(“The Sum of two Number is =”+c);    //printing 

}                                                                                           the sum

}

 ...................................end..............................................

 

 

 

Sunday, 6 September 2020

INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) IN EASIEST LANGUAGE

INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING

Object-Oriented Programming is also called OOP.

 Definition :

The Object-oriented progamming (OOP) is a programming methodology that helps to organize set of instructions in a proper sequence to develop program or software.

The Great advantage of OOP

The main and great advantage of OOP are to make complex software faster to develop and easier to maintain.

It also enables the easy reuse of code by applying simple and widely accepted rules of OOP principles.

so...

WHAT IS THE PRINCIPLES OF OOP ?

There are four types of OOP Principle -

1)Abstraction

It is an act of representing essential feature without including background detail and explaination.

2)Encapsulation

The act in which data and method are combined together in the form of single unit is known as encapsulation.

For example :

You are very much familiar with medicines. A capsule is also a medicine which contain combination of many medicine in the form of powder(encapsulated form of medicine). Same as when many object are combined/encapsulated to form a single object is called encapsulation.

3)Inheritance

When one class requires the property of other class is called inheritance.

Base Class : The existing class whose properties are inherited by some other class is known as base class or super class.

Derived Class : The class that acquire the property from existing class is known as derived class or sub class.

For example :

lets take a example from real world please dont mind suppose your father is a super class and you as child is sub class and its obvious that some properties or habits of your father is inherited to you so..thats called inheritance.

4)Polymorphism

When one class is having many form means when one function behave differently in a same class.

For example : The color class may have a method named Paint()

that can be used to paint various color as shown...


.....................................................end...............................................