JAVA CONSTRUCTOR & OVERLOADING

//This is the final code for example of all constructor ,method overloading,and how can create object..Can you help from this.i want,which i can i post all slowly slowly.you can give me any comments

class world //this is a class name
{
String name,add; //string type variable
int i,j,k,x,y,z; //int type variables
world() //this is a default constructor method
{
System.out.println(“Hi!This is saddam hossain rana.”);
}
world(String name) //this is a normal constructor method and happen overloading
{
System.out.println(“I am a student of Southeast University.”);
}

world(int i) //this is also a normal constructor method and also happened overloaded
{
System.out.println(“I want to be a good programmer.”);
}
/*world(int z) //it is not possible because same method’s has no takes same types parameter,combination should must be changed
{
System.out.println(“Do or die”);
}*/
void show() //this is a normal method without parameter
{
System.out.println(“Love me less but love me long”);
}
void show(int j) //this is a normal method with parameter and also happened here overloading
{
System.out.println(“My batch no is:23rd”);
}
/*void show(int x)
{
System.out.println(“How are you brother…???”);
}*/
void method() //this is a normal method
{
System.out.println(“I want to be a extreme web developer.”);
}
void method(int j) //this is a normal method and here also happen method overloading
{
System.out.println(“i want to be a good human”);
}
void show(int z,int x) //this is a normal method and overloaded and it’s declares two variables
{
System.out.println(“Hey Guys!How are you………..?”);
}
void show(int x,String name) //normal method and overloaded and declares two variables
{
System.out.println(“My father loves me very much.i love him also more than my life.”);
}
void show(String name,int x) //normal method and overloaded and declares two variables ,same to up method
{
System.out.println(“i love my mother most more than my father.”);
}
world(int i,String name) //normal constructor method and it takes two variables.different constructor method always takes different parameter
{
System.out.println(“I want to be a good girl who really love me.”);
}
world(String name,int i) //normal constructor method and overloaded and two types variables
{
System.out.println(“Good night”);
}
world(int i,int j,int k,String name,String add) //normal constructor method and two types variable but takes 3 int and two string
{
System.out.println(“This is really a confused program…Like me ..because i am also a very confused and hesitate person.”);
}
void show(int i,int j,int k,String name,String add) //normal method it has taken also up
{
System.out.println(“i have nothing to say more of this program…”);
}
public static void main(String args[]) //main method
{
System.out.println(“This is a example of total overloading and overriding.everybody can help from this program.Its created by Saddam Hossain Rana.”);
world object=new world(); //creating object for class world and call default constructor method
world object1=new world(“Rana”);
world object2=new world(4);
object.show(); //creat object for normal methods
object.show(5);
object.method();
object.method(8);
object.show(6,9);
object.show(4,”rana”);
object.show(“rana”,6);
world object3=new world(4,”love”);
world object4=new world(“add”,9);
world object5=new world(4,2,6,”rana”,”saddam”);
object.show(4,2,6,”rana”,”saddam”);
//object.show(4);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *