Please call your class Weight rather than weight. I am not convinced it is a good idea to have two co‑dependent fields; if you change g without changing Kg (under the usual conventions that should read kg), you'll have an error in the state of your object.
As for the compiler error, the bit with 0001* in is a statement; statements must be in a method, constructor, etc., rather than just lying loose in the body of the class. If you say the error message isn't very helpful, I think I shall agree with you.
For experimentation, I would suggest creating a main() method.
This code might be a good starting point (put inside your class):
I would also pick a much better variable name than "g". A program (and variable names) that seems obvious while you're working on it can look totally foreign in a few months or even weeks. So, creating self-documenting variable names is a good practice for you or for the person who might have to maintain your code later.