1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
polet [3.4K]
3 years ago
11

Demonstrate constructor overloading by both declaring relevant constructors of your choice and invoking them. [

Computers and Technology
1 answer:
mixas84 [53]3 years ago
4 0

Answer:

Constructor overloading means constructor having same name but different signature

Parameter of constructor are depend upon

Number of parameter

Type of parameter.

Sequence of parameter

When we create an object of an class the compiler determines which type of constructor is call by comparing its signature of constructor.

For example:

Following are the constructor overloading  program in java

class abc // creating class

{

 int r;

 String name;

abc(int r1)        // Constructor 1

 {

 r = r1;

System.out.println(r);

 }

 abc(String n1)        // Constructor 2

 {

 name=n1;

System.out.println(name);

 }  }

class Main  // main class

 {

 public static void main(String[] args) // main method

  {

    abc  ob=new abc(1);  // object 1

     abc S2 = new abc("Sumit");  // object 2

       }

 }

Output:

1

Sumit

In this program, we have two constructors.

object 1 will call constructor 1 because  the signature of constructor 1 is matched to the statement 1.  

object 2 will call constructor 2 because  the signature of constructor 2 is matched to the statement 2

You might be interested in
Select the things you can do when working with rows in columns in a spreadsheet:
pantera1 [17]

Answer:

no uttar hai hai hai hai hai uara ke sook na mane yara मर aa

5 0
3 years ago
Jacinta registered herself on a social-networking site. She receives one or two emails every day about promotional offers as wel
Rainbow [258]
It would be Spam. . . . 

3 0
4 years ago
"Bullet Lists" can be which of the following?
MariettaO [177]

Answer:

letters and numbered

Explanation:

7 0
4 years ago
Read 2 more answers
Question 1<br> What does the % find?<br> The product<br> The mode<br> The quotient<br> The remainder
Paul [167]
The correct answer is the remainder
7 0
4 years ago
Create a python program that display this
aleksley [76]

Answer:

vxxgxfufjdfhgffghgfghgffh

4 0
3 years ago
Other questions:
  • Zack is working on an assignment at school. He wants to save his work so he can take it home and complete it on his home compute
    13·1 answer
  • Which of the following is an attack that adds SQL statements to input data for the purpose of sending commands to a database man
    8·1 answer
  • Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6
    6·1 answer
  • Write one similarity and one difference between '_' (underscore) ' % ' wildcard symbol .
    11·1 answer
  • The kinetoscope is ___________________ a. a disk with a series of drawings around the edge, showing the same object in slightly
    9·2 answers
  • Which of the following is not a language commonly used for web programming? PHP Assembly Java Python
    6·2 answers
  • PLEASE HELP me with at least 1 of the problems in the picture <br><br>We are coding using python​
    14·1 answer
  • What refers to a set of instructions executed in order?
    6·1 answer
  • You are creating a program that can add up the amount of money the user spent that day. Right down to the penny! What kind of va
    12·2 answers
  • An Accenture healthcare client is interested in implementing an Artificial Intelligence (AI) solution to improve patient care, b
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!