(a) What is run time error? Explain with an example.
(b) Write Java expression for the following Mathematical expression V = a cube + b cube / 3
Answers
Answered by
4
Answer:-
Question 1.
The errors that occurs during the execution of a program(i.e, at runtime) is called runtime error.
Example:- Division by zero.
For example, consider this program
class x{
public static void main(int a, int b)
{
System.out.println(a/b);
}
}
Now, if the user enters a=5 and b=0 from command line then,
a/b=5/0 which is undefined. This results in runtime error.
Question 2.
Java expression for V=a³+b³/3 is,
double V=Math.pow(a, 3)+Math.pow(b,3)/3.0;
Answered by
1
Answer:
a) The error occuring while the execution of the program is called the Runtime error.
Example:
int a=10, b=0, c=0;
c=a/b;
//Here u are dividing a by 0.
b) Java expression for :V = a cube + b cube / 3
double V=Math.pow(a, 3) + Math.pow(b,3) /3;
Similar questions
English,
3 months ago
Social Sciences,
3 months ago
Social Sciences,
3 months ago
Math,
6 months ago
History,
6 months ago
English,
11 months ago
Social Sciences,
11 months ago