Constructor Overloading

Constructor Overloading.
Definition : Can Create as many constructor in our class. Constructor overloading can differ in parameter lists in class. The compiler taking into account the number of parameters in the list and their Type.

package javaconstructor;
/*
* @description
* – Constructor overloading is just create another constructor.
* – same name as of class but different signature (parameters).
* – Compiler differentiates which constructor is to be called depending upon the
* number of parameters and their sequence of data types.
* @author Frank Nandong
*/
public class cons_overloading {

public cons_overloading()
{
System.out.println(“Constructor default”);
}
public cons_overloading(int x)
{
System.out.println(“Circle perimeter: ” + 2*Math.PI*x);
}
public cons_overloading(int x, int y)
{
System.out.println(“Rectangle perimeter: ” +2*(x+y));
}

public static void main(String args[])
{
cons_overloading p1 = new cons_overloading();
cons_overloading p2 = new cons_overloading(10);
cons_overloading p3 = new cons_overloading(10, 20);
}
}

Parameterized Constructor – java

Is part of Constructor:

What is Parameterized Constructor ?
– Constructor that have the parameter.

Why we need Parameterized constructor ?
– To provide different valuse to distinct objects.

Lets look the example:

package javaconstructor;

// My Parameterized Constructor

public class parameterized_constructor {
intid;
String name;

parameterized_constructor(int i, String n){
id =i;
name = n;}

void display(){
System.out.println(id+” “+name);}

publicstaticvoid main(String args[]){// To provide different values to distinct objects.

parameterized_constructor s1 =new parameterized_constructor(101,”raju”);
parameterized_constructor s2 =new parameterized_constructor(102,”ahmad”);

s1.display();
s2.display();

}}

Let Start from the core: Java – constructor – “Lets check the Instance of Frank Cake Class “

Image

1. My Understanding of Constructor – Java “not bahasa Jawe”?

  • Constructor is a special method that is use to initialize object of a class. All Java Object have Constructor, Even I not declare at java class, because any Java Class Compiler builds a default constructor.
  • Constructor does not have return Value.
  • Need to Understand More deeply how it work : “ Object must be explicitly constructed. The process of constructing an Object means, First – Finding Some Unused Memory in the heap that can Hold the Object. Second – Filling in the Objects instance Variable”
  • The name of Constructor has the same name with Class, Construtor method been called when object of clas is created.

Lets STarT – “Lets SQueeze Lemon into Frank Dough”

2. There are two Common Constructor:
2.1. Default Constructor.
2.2. parameterized constructor

2.1. Default Constructor
Lets Start to Create Frank Cake Default Constructor.

package javaconstructor;

Create a java program – constructor -“My Piece of Cake”

// Default constructor
public class cakeFrank {

// constructor method – default constructor
cakeFrank()
{
System.out.println(” Just Note of Recipe “);
}

public static void main(String args[]){
cakeFrank cf = new cakeFrank();
}

}

OUTPUT/run in java runtime: Just Note of Recipe

Lets Learn Deep Again , Why we need constructor:
Its Realy Nonsense if I wrote without knows the Benefit.

check It Out:
2.1.1. If there is no constructor , or You not COPY PASTE to get example exactly code from any site,and you missing constructor:
don’t worry, Constructor is automatically created the constructor. Look DoWN:

cake_constructor_default

2.1.1.1. The Purpose of COnstructor:- Default Constructor provides the Default values of the object.

2.1.1.1.1. What Is the Default Value???
null and 0

Beginner JQuery “Write Less – Do more”

Web Design – CoDe Time.

What is JQuery:- JQuery make our code more short and simplified with feature-rich javascript Library.

History of JQuery:

JQuery Developed by John Resig. I read his profile, his age same as Me… 1984. JQuery is a multi-browser Javascript library to simplify the client sid scripting of html.
check his blog for more information about him.

Reminder:
JQuery is not Programming Language – It just Javascript library that make javascript programming more simplified and faster.

1. Lets Start Work – “Without Hammer it Dangerous to use Hand to pull the nail through THE Wood
– Get the JS lib:

–          Get the JQuery lib – I use jquery-1.9.1.js – can be download from – http://jquery.com/download/