System won't print this out? [closed]

What you are looking for is more like this:

public class Exercise {

    private static int x = 12;
    private static int y = 28;
    private static double z = 3.3;

    public static void main(String[] args) {
        double result = calculate();
        System.out.println("The answer to (x * y) / z is " + result);

    private static double calculate() {
        double you = (x * y) / z;
        System.out.println("you = " + you);
        return you;

As others said, a return must be the last instruction of the method (unless enclosed in a conditional).
You have also to be careful: printing "you" is not the same as printing you the variable.

Browse More Popular Posts

Leave a Comment