When I write a class Widget.java
public class Widget {
int data;
String name;
}
will the compiler-generated constructo
Depends on class visibility. For your class dafault constructor is going to be public.
In a class type, if the class is declared public, then the default constructor is implicitly given the access modifier public (§6.6); if the class is declared protected, then the default constructor is implicitly given the access modifier protected (§6.6); if the class is declared private, then the default constructor is implicitly given the access modifier private (§6.6); otherwise, the default constructor has the default access implied by no access modifier.
From here.