what is default constructor?
Answers were Sorted based on User's Feedback
In d object_oriented programs actually we interacting with
the methods with the objects only.Objects are constructed
when we create an object the compiler automatically calls
one constructor i.e default constructor.if we explicitily
mention a constructor i.e if we pass any arguments it is
called explicit constructor.
This can be briefly explained based on below ex. i am
writing d code in java.
class Sample
{
int x,y;
Sample()
{
x=12;
y=13;
}
Sample(int a,int b)
{
x=a;
y=b;
}
void display()
{
System.out.println("values are"+x+y);
}
}
class SampleDemo
{
public static void main(String args[])
{
Sample s=new Sample();//default constructor;
s.display();
Sample s1=new Sample(12,13);//parameterized constructor
s1.display();
}
} if u have any doubts contact me
venugopal.palavalasa@gmail.com
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vaibhav
in java once the memory is instantiated at that time constructor will call by internally.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can you write the function prototype, definition and mention the other requirements.
which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..}
Write a C program to find the smallest of three integers, without using any of the comparision operators.
main is a predefined or user define function if user defined why? if predefined whay?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
what is the definition of storage classes?
What is stack in c?
Why c is a mother language?
How many levels deep can include files be nested?
What is the explanation for the dangling pointer in c?
What are data structures in c and how to use them?
How can I find out how much free space is available on disk?