When we have a class like this which doesn't have any constructor:
public class F {
public void sum() {
System.out.println("print it");
}
How does the main
method create an object of this class? Does the object already have a constructor?
public static void main(String[] args) {
F obj = new F();
obj.sum();
}
}
Does Java have a default constructor like this:
public class F() {
}