الرجوع
تسجيل الدخول

What will be the output of the following Java code snippet?

public class JavaTest {
    public static void main(String[] args) {
        final int MAX_SCORE = 100;
        int score = 50;
        double percentage;
        float increaseFactor = 1.2f;

        score += 30; // Shorthand for score = score + 30
        percentage = (double) score / MAX_SCORE;
        increaseFactor *= 2; // Shorthand for increaseFactor = increaseFactor * 2
System.out.println("Updated Score: " + score);
        System.out.println("Percentage: " + percentage * 100 + "%");
        System.out.println("New Increase Factor: " + increaseFactor);
    }
}