Why is this happening with code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this happening with code?

When I call methods using different objects it give me same output rather then giving me different outputs for different object? https://code.sololearn.com/cKpru3QkmicX/?ref=app

7th Mar 2020, 9:53 AM
Muhammad Bilal
Muhammad Bilal - avatar
2 Answers
+ 1
Here I wrote a little comment on changes https://code.sololearn.com/cis3GcFHkReU/?ref=app
7th Mar 2020, 12:08 PM
Ipang
+ 1
Read about Static variable in Java. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class. You should remove the static keyword for your class variables. Then first get user inputs to separate weight and height variables and pass that while object creation.
7th Mar 2020, 11:32 AM
ROBIN C R
ROBIN C R - avatar