English

Consider the following program segment and answer the questions below: class calculate { int a;double b; calculate() { a=0; b=0.0; } calculate(int x, double y) { a=x; b=y; } void sum() { System.out. - Computer Applications

Advertisements
Advertisements

Question

Consider the following program segment and answer the questions below:

class calculate
{
     int a;double b;
     calculate()
     {
     a=0;
     b=0.0;
     }
     calculate(int x, double y)
     {
     a=x;
     b=y;
     }
   void sum()
   {
     System.out.println(a*b);
}}

Name the type of constructors used in the above program segment.

One Line Answer

Solution

Default constructor, Parameterized Constructor

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (April) Specimen Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×
Our website is made possible by ad-free subscriptions or displaying online advertisements to our visitors.
If you don't like ads you can support us by buying an ad-free subscription or please consider supporting us by disabling your ad blocker. Thank you.