I am coming from C++ so there is one feature of java that I don\'t quite understand. I have read that all objects must be created using the keyword new, with th
The new must be written in Java to create a new object instance.
public class Foo {
public void test() {
final Foo foo1 = new Foo();
final Foo foo2 = Foo();
}
public Foo Foo() {
System.out.println("hello world");
return this;
}
}
Note, that methods starting with an uppercase character are discouraged in Java to avoid the confusion.