Java Error: The constructor is undefined

前端 未结 9 1251
庸人自扰
庸人自扰 2020-11-29 13:31

In Java, Why am I getting this error:

Error: The constructor WeightIn() is undefined

Java Code:

public class WeightIn{
  pr         


        
9条回答
  •  旧时难觅i
    2020-11-29 14:08

    Add this to your class:

    public WeightIn(){
    }
    
    • Please understand that default no-argument constructor is provided only if no other constructor is written
    • If you write any constructor, then compiler does not provided default no-arg constructor. You have to specify one.

提交回复
热议问题