Method Overriding

******************** Demonstrating method Overloading *****************************

CLASS 1


package overridingclasses;

/**
 *MobileClass.java
 * @author SHASHI
super class 
 here method and constructor is defined

 */
public class MobileClass {
    
  //variable declaration
    String Manufacture;
    int cost;
    
//constructor to set value
    public MobileClass(String manu, int price) {
        this.Manufacture= manu;          // this to assign value to variable with constructor input
        this.cost= price;
    }
    
   String getModel(){                                 // created method to display value from constructor domain
       System.out.println("Method of mobile class");
       return Manufacture;
    }
    
}


*********************************** *********************************************
CLASS 2


package overridingclasses;

/**
 *AndroidClass.java
 * @author SHASHI
 */
public class AndroidClass extends MobileClass {             //Class extending to super class  

    AndroidClass(String manu, int cost) {                   // constructor to take input common to both class
        super(manu, cost);                                         //super to call value from super class
    }

    String getModel() {                                                //method to do calculation
        System.out.println("method of android class");
        return Manufacture;
    }
}


***************************************************************************8
CLASS 3


package overridingclasses;

/**
 *OverRidingClasses.java
 * @author SHASHI

main class performing overriding  of methods
 */
public class OverRidingClasses {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
         MobileClass ob1 = new AndroidClass("Huwai", 1987);  // created object of android class 
        System.out.println(ob1.getModel());         // called common method but it display only subclass method this is overriding concept.
    }

}


********************************************************************************
OUTPUT
Method of mobile class






















Demonstrating Method Overloading


package OverLoadingSampleClass;

/**
 *OverLoading.java
 * @author SHASHI
*
* here we are demonstrating a basic example of overloading of methods
* the print method has 3 different parameters but the method name is same so a method having the same name but different parameter can be considered under method overloading method
 */
public class OverLoading {
   
  void  print(String s){                                     //metnhod with string parameter
        System.out.println("String through overloading is  "+s);
    }
 void  print (int i)                                               //method with int parameter
    {
       
        System.out.println("Integer no through overloading is "+ i);
    }
 void   print (String s, int i){                             //same method with string and int parameter
        System.out.println(" overloaded string is "+ s + " and overloaded integer is "+i);
    }




}
class  OverloadDemo {             //class made outside of package class to call the methods of that class
     
     public static void main(String[] args) {
          OverLoading ob = new OverLoading();
     
         ob.print("sj");
        ob.print(99);
        ob.print("reliance", 33);
     }
   
 }



********************************** output **********************************
String through overloading is  sj
Integer no through overloading is 99
 overloaded string is reliance and overloaded integer is 33

Feelings!!!

It is the most beautiful feelings in life. When u start caring for someone and u get attached to him u start feeling the hidden emotions of the person you care. Not only in case of relationship where one cares about other but also in case of friendship it can be felt but the extent in a relationship it is felt more.

There are lots of benefits of caring ...

1. your heart always gets filled up.
2 u do not feel incomplete
3 after every problem when you remember your caring person a smile comes to your face and that smile is really priceless.

All these caring feeling shows its effect when you care truely and not just for show off.

This was my small thought about caring feeling hope you like it.