Sunday, 10 April 2016

OOPS

                               Hi guys lets get into an interesting topic that is (OOPS)- Object Oriented Programming Language, There are five different topics under this... We can see one by one in this class,
                          
                                                                    * INHERITANCE
                                                                    * POLYMORPISM
                                                                    * ENCAPSULATION
                                                                    * ABSTRACT
Lets roll into Inheritance.............

INHERITANCE:

                                Inheritance is one of the major concept in object oriented.The properties of one object in a class can be extended to the properties of one object in a class can be extended to the properties of object in another hand this is called as inheritance.

                                Inheritance uses the keyword extends , which is used to extend the properties from one class to another class. Inheritance have the two main terms they are the super class and the subclass there are various type of inheritance are used in java they are 

                                                                   * Single Inheritance 
                                                                   * Multilevel Inheritance
                                                                   * Hierarchy Inheritance

SINGLE INHERITANCE:

                         Single inheritance extends the properties from one class to the another class like the   class B extends the properties of A.

                                                          class  A
                                                               { 
                                                                   }
                                                           public class B extends A{
                                                           public static void main (String args[])
                                                                 {
                                                                }
                                                                  }

MULTILEVEL INHERITANCE:

                         Multilevel inheritance extends the properties from one class to the another class like the class C extends the properties of B and B extends the properties of A.

                                                         class A

                                                         {

                                                          }
                                                        class B extends A
                                                         {
                                                            }
                                                       public class C extends B
                                                         {
                                                      public static void main (String args[])
                                                           {
                                                             }
                                                          }

HIERARCHY INHERITANCE:

                        Hierarchy inheritance extends the properties from one class to the another class like the class C extends A and also the class B extends A.
     
                                                          class A
                                                           {
                                                           
                                                             }
                                                         class B extends A
                                                            {
                                                             }
                                                        public class C extends A{
                                                        public static void main (String args[])
                                                                {
                                                                    }
                                                            }

POLYMORPHISM:

                  Polymorphism is the ability to take more than one form. For example the same person contain the different behavior based on the time. In java there are two type of polymorphism they are.
                                                          *  Method overloading 
                                                          *  Method overriding

METHOD OVERLOADING:

                 Method overloading contain the same return type, same function name with different types of arguments in same class.

Example;

                                                   public class MethodOver{
                                                      void a()
                                                         {  
                                                            system.out.println(TONY);
                                                          }
                                                       void a(int a)
                                                            {
                                                               System.out.println(Rajesh);
                                                            }
                                                        void a(int a,int b)
                                                             {
                                                                system.out.println(Ranjith);
                                                               }
                                                    public static void main(String args[])
                                                             {
                                                                MethodOver obj=new MethodOver();
                                                                       obj.a();
                                                                       obj.a(2);
                                                                       obj.a(2,3);
                                                                }
                                                           }

METHOD OVERRIDING:

                     It contain the same function name, same return type and same arguments in different class.

                                                           class A
                                                             {
                                                                void a()
                                                                     {
                                                                         system.out.println(Rajesh);
                                                                      }
                                                               }
                                                           class B
                                                              {
                                                                 void a () 

                                                                   {
                                                                      system.out.println(TOny);
                                                                    }
                                                               }
                                                            class C
                                                               {
                                                                  void a()
                                                                {
                                                                    system.out.println(Ranjith);
                                                                }
                                                                 }
                                                           public class Methodover{
                                                           public static void main (String args[])
                                                                   {
                                                                     A obj1=new A();
                                                                     B obj2=new B();
                                                                     C obj3=new C();
                                                                       obj1.a();
                                                                       obj2.a();
                                                                       obj3.a();
                                                                    }
                                                                     }

Friday, 8 April 2016

METHODS

          Methods is he collection of statements to  perform an operation. Methods contain the collection of statements and it is used to perform any task that related to the program.

          Method reduces the complexity of the program. For example method reduces the complexity of the program.For example method likes the capsule whenever we need we can call the method to the respective position.

           Method can be called with the help of the object. Methods contain different return type such as int, byte,short , long, float, double , string , char and boolean. If the method contain the void return type it will not return anything.

Syntax:
   return_type method_name(arguments) 
{
//statements
}
This is the basic syntax of the method in java for example 

  Void method1()
{
system.out.println(Hello Tony);
}

              If we used other return type rather than the void we need to return something for example,
int method1()
{
system.out.println(Hello Tony);
return 0;
}

             We can able to pass the value to the method by the help of arguments that is called the parametrized method. It contain the arguments for example.

int method1(int a )
{
system.out.println(a);
return (0);
}

              This are the various formats and uses of the method in java. well here we are going to call the method in the main method with the help of object.

public class TONY                {
void a();
{
system.out.println(hi);
}
int n(int e)
{
system.out.println(e)
return 0;
}
public static void main (String args[])
{
TONY obj=new TONY();
obj.a();
obj.n(4);
}
}

Thursday, 7 April 2016

CLASS & OBJECT

              Class is the collection of object and properties, Properties in the sense it contain the methods, constructor and variables.For example the college contain the class rooms and the room is occupied by full of benches and chairs.
                 
                                Syntax:
                                              public class ja{
                                               public static void main(String args[])
                                                  {
                                               }
                                             }
              In the first line the public is the access specifiers and in java everything is a class and object . So we need to mention the class and ja is the class name of your project.          
               Then in the next line it contain the code that start with public it is also an access specifier , static is the keyword does not return anything , which means its not possible to return anything inside the void method.Main is the main method of the program. Inside the parenthesis you can able to see the string, In java string is an object and first letter of string should be capital letter . Then args[] is the command line argument in java and its used to get the input in the run-time.
          
                Java is case sensitive so you need to write the letters more accurately. If it is capital letter then you should give the capital letter.

CONSTRUCTOR:

               Constructor does not need object while creatin object itself constructor automatically called CONSTRUCTOR. It does not need anything. Constructor must have the class name this are the various rules of constructor.

                Syntax:  
                             class name()
                                {
                                   //statements
                                         }
                              A()
                                  {
                                    System.out.println(TONY);
                                       }
 
                There are another type of constructor called parametrized constructor which is used to pass the values to the constructor for example  ,
                     
                    Syntax:
                                 A(int a)
                                  {
                                        system.out.println(Rajesh);
                                 }

                Now we are going to call the constructor from the main method ,

                      Syntax:
                                   public class A{
                                    A(int a)
                                {
                                  System.out.println(ToNy);
                                   System.out.println(rAjEsH);
                                  }
                               {
                                    public static void main(String args[])
                                  {
                                          A obj= new A(25);
                                 {
                                    }
                                     } 

                                             OBJECTS

                Object is the real world entity and it is the instance of a class or the behavior of the class. For example in a class there are benches and the chairs, Those are called the objects. If we create the object means the entire class can be accessible with the help of that object. With the help of object it is possible to call the method, variable an the datatype inside the class.

                Syntax:
                             public class To{
                               public static void main (String args[])
                              {
                                 To obj = new To();
                                } 
                              }

                 In the above code we have been created the object inside the main method (To obj) this is the reference to the object, it will create the memory for your object, (new To();) this is used to allocate the memory according to the properties and it is also know as the constructor. This all together called as the object in java. To call the variable , method using object place the following code in your project

                  Example :
                                     public class To{
                                        int a=10;
                                        void method()
                                     {
                                         System.out.println(Hello world);
                                         }
                                          Public static void main (String args[])
                                         {
                                             To obj = new To();
                                              obj.method();
                                              System.out.println(obj.a);
                                             }
                                         }
 

Wednesday, 6 April 2016

COMMAN CONCEPTS

ACCESS SPECIFIER:

          Java Access specifiers (also known as visibility specifiers) regulate access to classes fields and methods in java . These specifiers determine whether a field or method in a class can be used or invoked by another method in another class or sub-class. Access specifiers can be used to restrict access. Access specifiers are an integral part of object-oriented programming.

                                   TYPES OF ACCESS SPECIFIERS:

                                                                  1)  Public
                                                                  2)  Private
                                                                  3)  Protected

PUBLIC SPECIFIERS:

            Public specifiers achieves the highest level of accessibility. Classes, methods, and fields declared as public can be accessed from any class in the java program, whether these classes are in the same package or in another package.
             Example:
                                      Public class Tony{
                                       public T, o, size;
                                      }

                                                        

                                                            

                                                            

Saturday, 2 April 2016

COMMON CONCEPTS

Data Type:

          Data type is used to store the value in different formats like whole number, decimal numbers, characters, strings, and the Boolean values. 
          java contain he eight type of datatype they are BYTE,INT,SHORT,LONG,FLOAT,DOUBLE,CHAR,STRING,and BOOLEAN. But character does not taken as datatype because it is Unicode in java which is used to perform the compatibility for all the JVM (Java Virtual Machine).

         Byte is the whole number in java and it contain the 8 bits as memory. To declare the byte datatype you need to enter like this --> byte b=10;

         Int is the integer and it also contain the whole number .it contain the 32 bits or 4 bytes of memory. To declare the Int datatype type the following --> int b =10;

         Short is also the whole number it contain the 16 bits and 2 bytes of memory in java. To declare this datatype type the following --> short b=10;

          Long is also the whole number it contain the 64 bits and 8 bytes of memory. To declare the long datatype type the following --> long b=10;

          These four datatype are whole numbers and they are called as INTEGER LITERALS. These are two type of the decimal point literals in java they are float and double. Whereas float is the 32 bit datatype and to declare the float datatype type the following code.---> float b=10.0;

          Then double is the 64 bit datatype to declare the double datatype use --> double b=10.00;

           String is the object in java and it is used to get the string objects in java. To declare this datatype use --> string s = tony;

           Char is the unicode in java and it contain the ASCII code for the respective values.It is 16 bit and it contain the java Unicode in java. To declare this datatype --> char c=h;

           Boolean is the datatype that contains TRUE or FALSE option . TO declare the datatype use --> boolean b = true;
boolean b= false; 

IDENTIFIERS AND LITERALS:

        Identifiers is used to identify the properties of the method and the object in java. For example to identify the person we use the name of the person. Now here ,  to identify the value we are using the variable name. It is used for the method , object and the variable name . For example, Now the variable is initialized like 
                                                          int a=25;
        In the above example the variable ( a )  contain the value 25 . Even though the variable is named as ( a ) while calling in technical it is named as Identifier.
                                                               class A{
                                                                int a=50;
                                                              public static void main (String args[])
                                                                  {
                                                                    A obj = new A();
                                                                   System.out.println(obj);
                                                                     }
                                                                   }     
         When literals is the permanent value for the variable , ti contain the value according to the data type . For example the integer contain the value                                                                
                                                                         int a=25;
           In the above example the value 25 is called the literals.                                                                              
                                                                      
            And this is the end of this session , today we have learned DATA TYPES and  IDENTIFIERS AND LITERALS.                                                              

Friday, 25 March 2016

Entering Into Java

Hi all...
    
     Sorry for the long gap of not posting, here we are ready to continue with our new topic on JAVA ,

     As we all know java is a computer programming language that is class-based , object-oriented programming . It specifically designed to have a function (WORA) Wrire Once Run Anywhere which means the code from it runs in one platform (i.e created in one platform) does not need t o be recompiled to run in another platform .
      Java application is typically compiled to bytecode that are run in any java virtual Machine, Here a virtual machine is one which is a tool  to run multiple operating system , or operating multiple OS in a single base machine.
      It also have a specific term for clearing unused data automatically , This process is termed as Garbage Collection.

COMMON CONCEPTS OF JAVA

 JAVA FEATURES:

       For java there are several features categorized by their performance and access ,
  • Simple
  • Robust 
  • Dynamic
  • Distributed
  • Secure
  • Platform independent
  • Object oriented
  • Portable
  • Multi-thread
       Now we can see why these are termed as features, Java is SIMPLE because it uses most of its syntax from c and c++ language, It does not use Pointers to address the variable.

        Java is ROBUST because it contains the garbage collection it does not have any pointers and it does not contain the destructor.

         Java is DISTRIBUTED because the source code can be used in all the system that contain the (JVM) Java Virtual Machine.

         Java is SECURE because pointers is not used in this, pointers are considered as a least secure thing in C.

         Java is PLATFORM INDEPENDENT because it contain the bytecode, you can compile the code in one system and read the code from any system called WORA.

         Java is OBJECT ORIENTED because it is full of object based operation and it uses various type of its language.

         Java is PORTABLE because of the bytecode it use and run in any system.

         Java is MULTI-THREAD , it is a key feature of the java it contain the single memory allocation for all the process.

     That's all for Today's class, today we have seen what is java and its common features , the rest will be covered later.

Monday, 20 July 2015

New Version

hi to all.......
once again... im here to explore a new version of my upto dates.....
Lets start with a new version of Java basics , from now ill make u all clear with basics..
Java was developed by sun micro system in 1995 , james Gosling, Mike sheridan  and patrick naughton was the initiators of java , James gosling was started this project in the year 1987 as a personal project that is called the STEALTH  project and then he proposed the project to the sun micro system.

These three programmers started the project called GREEN PROJECT in the year 1991 and they released with the name called OAK . Oak is the tree which present in front of their home, Then they changed the project name into JAVA.. which is the name of  a island in indonesia and it also a tea name. which plays a major role in developing their projects....

Thats y they make the logo like the cofee cup and these where the reason they selected cup as a logo for java . They started with jdk 1.0 and now they released J2SE 8.0 then Oracle have been take over of java from Sun MicroSystem.