Java Error: The constructor is undefined -


in java, why getting error:

error: constructor weightin() undefined 

java code:

public class weightin{   private double weight;   private double height;    public weightin (double weightin, double heightin){     weight = weightin;     height = heightin;   }   public void setweight(double weightin){     weight = weightin;   }   public void setheight(double heightin){     height = heightin;   } }  public class weightinapp{   public static void main (string [] args){     weightin weight1 = new weightin();         //error happens here.     weight1.setweight(3.65);     weight2.setheight(1.7);   } } 

i have constructor defined.

add class.

public weightin(){ }

  • please understand default no-argument constructor provided if no other constructor written
  • if write constructor, compiler not provided default no-arg constructor. have specify one.

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -