Trustapple wrote:
i am a beginner with out null programming backing thats why i have so many questions
First of all, if you are so new to programming start reading about OOP (Object Oriented Programming)
Trustapple wrote:
my doubts are here: public Program(int x, int y) { a = x; b = y; } what is the purpose of a,b in this code......
As you may have noticed, the "function" Program has it's name the same as the class...that means it's a constructor. In your example you have 3 constructors. One with no parameters
public Program()
{
...
}
One with 2 parameters
public Program(int x, int y)
{
...
}
And one with 3 parameters. In the last 2 constructor you store the values received as parameters into local variables. When you have 3 constructors you can create an object of Program type like this
Program obj = new Program(); //default constructor - no parameters
Program obj1 = new Program(1,2); //constructor with 2 parameters
Program obj2 = new Program(1,2,3); //constructor with 3 parameters
For more details about overloading constructors...try Google. Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't