Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Constructor is a non-static method having the same name as its class - Core Java
Home
>>
Category
>>
Java (MCQ) questions and answers
>>
Core Java
Q. Which is a non-static method having the same name as its class?
- Published on 13 Jul 15
a.
Field
b.
Method
c.
Constructor
d.
None of the above
ANSWER: Constructor
Related Content
Core Java (
160
)
JDBC (
45
)
Hibernate (
12
)
Struts (
26
)
EJB (
25
)
RMI (
23
)
JSP (
22
)
Servlets (
27
)
Applets (
24
)
AWT and Swing (
25
)
Wrapper classes (
15
)
Basic concept of Networking (
19
)
XML (
32
)
Discussion
Rupesh Bharuka
-Posted on 30 Sep 16
Constructors are the special functions which has same name as of class name without any return type, not even 'void'
Now somebody might be thinking why constructors are 'non-static' method?
Because, constructors gets called when an object of that class is created. But static methods are such which we can call even before object creation. That's why constructors are always 'non-static'.
➨
Post your comment / Share knowledge
Required!
Required!
Invalid Email Id!
Required!
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
MCQs
English
Tutorials
Download
▲