Occupied by the UK in 1841 , Hong Kong was formally ceded by China the following year ; various adjacent lands were added later in the 19th century .