class Foo {
int size;
String name;
Foo(String name, int size) {
this.name = name;
this.size = size;
}
}
Foo class does not have a no-arg constructor. That means the following will fail to compile:
Foo f = new Foo(); // Won't compile, no matching constructor
but the following will compile:
Foo f = new Foo("Fred", 43); // No problem. Arguments match the Foo constructor.
|