Почему если описать функцию таким образом компилятор ругается? public static double getWeight(int weightEarth) { return double weightMoon = weightEarth * 0.17; } А таким нет: public static double getWeight(int weightEarth) { double weightMoon = weightEarth * 0.17; return weightMoon; }