Menu
Question Index
...

What will be the output of the following program?

public class Interest {
    public static void main(String args[]) {
        double principal = 1500.0;
        double time = 2.0;
        double rate = 4.0;
        double interest = calculateInterest(principal, time, rate);
        System.out.print("Rate of Interest: " + interest);
    }
    public static double calculateInterest(double principal, double time, double rate) {
        double interest = (principal * time * rate) / 100;
        return interest;
    }
}


Rate of Interest: 120.0
Rate of Interest: 130.0
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Methods - Parameter Passing And Scope

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App