

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java constructor return a value but, what?
No. Java constructor cannot return a value. If required, just create a method which calls the required constructor and returns the required value. See the example below.
public class Tester { public Tester(){} public static Tester getInstance(){ Tester tester = new Tester(); return tester; } }
- Related Questions & Answers
- Does constructor return any value in Java?
- What is the return type of a Constructor in Java?
- Does a constructor have a return type in Java?
- What is a constructor in Java?
- What is constructor overloading in Java?
- What is constructor chaining in Java?
- What is the purpose of a constructor in java?
- What are the differences between default constructor and parameterized constructor in Java?
- What are the constructor references in Java?
- Java default constructor
- Java parameterized constructor
- Java copy constructor
- Can the main method in Java return a value?
- What is the purpose of a default constructor in Java?
- What is the super() construct of a constructor in Java?
Advertisements