JAVA PROGRAMMING FOR BEGINNERS

              JAVA PROGRAMMING FOR                                            BEGINNERS


Basic concept oops

                  ObjectOriented Programming is a programming concept that works on the principle that objects are the most important part of your program. It allows users create the objects that they want and then create methods to handle those objects.


 Class

         The class is a group of similar entities. It is only an logical component and not the physical entity. 

Example-Mercedes, BMW, Toyota

 Object                   

            An Object contains both the data and the function, which operates on the data.

Example - chair, bike, marker, pen, table, car, etc.

Inheritance

        It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software.

 Polymorphism
            Polymorphism refers to the ability of a variable, object or function to take on multiple forms.

 Abstraction
         An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. 

Encapsulation
Encapsulation is an OOP technique of wrapping the data and code. In this OOPS concept, the variables of a class are always hidden from other classes.

Association
   Association is a relationship between two objects. It defines the diversity between objects. 

Aggregation
       In this technique, all objects have their separate lifecycle. However, there is ownership such that child object can’t belong to another parent object.

Composition
      A composition is a specialized form of Aggregation. It is also called "death" relationship. Child objects do not have their lifecycle so when parent object deletes all child object will also delete automatically. 

Classification of OOPS

  •         Unstructured Programming Languages
  •         Structured Programming Languages
  •         Object Oriented Programming

Unstructured Programming Languages
LET S = 0  
MAT INPUT V 
LET N = NUM 
IF N = 0 THEN 99 
FOR I = 1 TO N 
LET S = S + V(I) 
NEXT I 
PRINT S/N 
GO TO 5 
END


Structured Programming Languages


In object oriented programmingprogram is divided into small parts called objects. ... In object oriented programming, data is more important than function.Procedural programming is based on unreal world. Object oriented programming is based on real world.


Object Oriented Programming


           Object-oriented programming (OOP) refers to a type of computer programming (software design) in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure.

VARIABLE
             A variable can be thought of as a container which holds value for you, during the life of a Java program. Every variable is assigned a data type which designates the type and quantity of value it can hold.

CLASSES

  •       Variable Declaration
  •        Variable Initialization


Variable Declaration
·                                           The value stored in a variable can be changed during program execution.
·        variable is only a name given to a memory location, all the operations done on the variable effects that memory location.
·        In Java, all the variables must be declared before use.

Variable Initialization:

·        we have seen various types of variables in Java. In this post, i am going to discuss about its initialization and default values.
·        In Java, when variable is declared as field (static or instance variable inside class), then initialization of that variable is optional. In other words, while declaring field variable you may or may not initialize to its value.
·        If you are not, then Java runtime assigns default value to it. and when you try to access the variable you get the default value of that variable.

Types of variables

1.     Local Variables
2.     Instance Variables
3.     Static Variables

 Local Variables

                     Local Variables are a variable that are declared inside the body of a method.

 Instance Variables

                   Instance variables are defined without the STATIC keyword .They are defined Outside a method declaration. They are Object specific and are known as instance variables.

Static Variables

Static variables are initialized only once, at the start of the program execution. These variables should be initialized first, before the initialization of any instance variables.
    for other quarries and doubts visit here:http://www.techtutorial.in/java-interview-questions-and-answers/

Comments

Popular posts from this blog

Java Training in Chennai - Credo Systemz

Java Job opportunities