You can remember the meaning of 法官 with this easy mnemonic:
A judge knows the law (法) by heart, and is an official (官) of the court.
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.