Six colonies were created in the late 18th and 19th centuries ; they federated and became the Commonwealth of Australia in 1901 .