why the constructor should be used in class,if there is no
constructor what will happen?
Answer Posted / yamini
Constructor is used initialize certian paramameters to each
object on their creation.We can also overload
constructors.So we can initialize objects with diff params.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What type of variable is error flag?
How do you declare an empty string?
What is lambda in java?
What are the characteristics of Final,Finally and Finalize keywords.
Which is faster call by value or call by reference?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
How to solve the problem of generating the unique hash keys with hash function?
What are the different data types in java?
What is a key in java?
What is a values collection view ?
What are exception handling keywords in java?
What is difference between string and stringbuffer?
Explain polymorphism citing an example.
1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?
What is the default access specifier for variables and methods of a class?