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
Several people work with data at Erica’s office. She enters data. One of her coworkers enters new product numbers. Another cowor
Dvinal [7]

Answer:

a software program for storing, managing, and retrieving information

Explanation:

8 0
3 years ago
Help i give 20 shekel
Verdich [7]

Answer:hacking a computer is all I know

Explanation:

8 0
3 years ago
Which logging category does not appear in event viewer by default?
Ulleksa [173]

I believe this should have some multiple choice options: Application, System, Volume, Security.


The correct answer is volume.

7 0
3 years ago
A four-year old laptop will not boot and presents error messages on screen. You have verified with the laptop technical support
storchak [24]

Answer:

The first question you should ask yourself before performing the repair is Option B. Can you find a replacement motherboard.

Explanation:

According to me, I would ask “Can you find a replacement motherboard”.

Because, Always the laptop charge will be more than the charge of a mother board, because motherboard is just a part and the laptop consists of other important parts too. So Option (a) is not the wise selection.

Let’s look into option D. Warranty period should be verified by us and not the technical person, because we have purchased and we have the warranty card.

Let’s look into option C. The technical person will already be well-versed with fixing solution and diagnosing problem. So service manual will be of not much use to him and he would want to make money out of fixing the problem, so we cannot expect him to teach us how to replace a motherboard.

5 0
4 years ago
What kind of device should you install if you need the device to perform network address translation, facilitate access to the I
just olya [345]
The Correct Answer would Be A Router.
8 0
3 years ago
Other questions:
  • A windows computer is shared between several users, each with his own local user account. Each user has his own dedicated, uniqu
    9·1 answer
  • According to the article words have the power to change people's behavior. Describe one example of this from the article
    6·1 answer
  • QUESTION 8 Software applications that generate information are located in the first tier of n-tier architectures. True False
    7·1 answer
  • What is a file that has an .iso extension? What does this extension indicate?
    8·1 answer
  • What is the difference between a sequential program and an event-driven program?
    9·1 answer
  • Distributed computing is a term that describes the work that autonomous computers can do to achieve a common goal, especially in
    10·1 answer
  • You insert a comment in a worksheet by using a command on the ____ tab on the Ribbon.
    13·1 answer
  • What is the purpose of the GETPIVOTDATA function?
    13·2 answers
  • Write a print statement that displays a random integer between 5 and 5000. Assume the random library is imported.
    12·1 answer
  • The temperature at 8 AM was 44°F and at noon it was 64°F. what was the percent of change from 8 AM to noon?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!