I need this in Java please:
Behaviors. In the context of OOP, functions are called methodsor behaviors because they typically do something. Most often, theyread or change the values of one or more variables in the class.For example, you may have a weight variable in a class, and amethod called gainWeight( ) that increases the weight variable by acertain amount. For this part of the lab, create class KoalaBearthat has a weight attribute (in kilograms).
Create a constructor for the class that takes in (as aparameter) the initial weight of the koala bear. Then, write afunction called eat( ) that takes in the number of leaves the koalabear should eat. Each leaf weighs one gram, so you must increasethe weight of the koala bear by one gram. According to a sitededicated to saving Koala bears, they can eat between 200-500 gramsof leaves per day. To finish the class out, include a showWeight()method that prints out how much the koala weighs. In main, create akoala object starting at 100 kilos and show the koala’s weight.Then, make the koala eat 400, 300, and 650 leaves, showing theweight of the koala after each time it eats. NOTE: if you’re outputdoes not match exactly (because of the rounding of floating pointmath), that’s OK.
For example, Java will include some extra “precision”. Sampleoutput #1 This koala weighs 100.4 kilos This koala weighs 100.7kilos This koala weighs 101.35 kilos