- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 parameterized constructor
Yes! it is supported. A constructor with arguments is called the parameterized constructor. It is used to initialize an object with given values.
example
public class Tester { private String message; public Tester(String message){ this.message = message; } public String getMessage(){ return message ; } public void setMessage(String message){ this.message = message; } public static void main(String[] args) { Tester tester = new Tester("Welcome"); System.out.println(tester.getMessage()); } }
Output
Welcome
- Related Articles
- How to create a parameterized constructor in Java?
- What are the differences between default constructor and parameterized constructor in Java?
- Can we define a parameterized constructor in an abstract class in Java?
- What is a parameterized constructor in C# programs?
- Java default constructor
- Java copy constructor
- Constructor overloading in Java
- Enum constructor in Java
- Default constructor in Java
- Passing primitive values while instantiating a parameterized type (generic) in Java?
- Is constructor inherited in Java?
- Constructor Chaining In Java programming
- Constructor Overloading In Java programming
- Java Program to Show Inherited Constructor Calls Parent Constructor By Default
- What is constructor overloading in Java?

Advertisements