Answer:
It is true that one can send arguments to a constructor. Actually,
there are two types of constructors:
1. Without arguments: If we do not define a constructor for a class, then the compiler in JAVA creates a default constructor. Now, this default constructor is without any arguments. One thing to note here is that, if we do define a constructor for a class, then there's no creation of default constructor by the JAVA compiler.
2. With arguments: It is very simple to understand. With
arguments means that we define a constructor for a class and this
constructor is with arguments. We can pass various types of data to
a constructor.
I have executed a program where I have sent the argument to
a constructor. Here it is if you need it.
Program:
class constructor_with_arguments {
private String str; // data member of class constructor_with_arguments
// this is the constructor with arguments, it would
receive an argument st
// of
// type String
public constructor_with_arguments(String st) {
this.str = st; // initializing str with the value of st
}
// this is a member function of class
constructor_with_arguments
public String display() {
return this.str;
}
}
public class Chegg {
public static void main(String args[]) {
// here we are sending the
argument to the constructor
constructor_with_arguments Obj =
new constructor_with_arguments("Chegging");
System.out.println("Hey, Keep "
+ Obj.display());
}
}
Note: Please refer to the screenshot of the code to understand the indentation of the code.
Screenshot of the code:

Output:

The following question is about java programming. Is it true or false that one can send...