5 years ago in java.lang Package

What will happen when you attempt to compile and run the following code?


class MyCalc extends Math{
public int random(){
double iTemp;
iTemp=super();
return super.round(iTemp);
}
}

public class MyRand{
public static void main(String argv[]){
MyCalc m = new MyCals();
System.out.println(m.random());
}
}

[A] Compile time error
[B] Run time error
[C] Output of a random number between 0 and 1
[D] Output of a random number between 1 and 10
Loading...
Next Question

Overall Stats

Attempted 91
Correct 23
Incorrect 28
Viewed 40

Answers

Guest
Guest
bruh
bruh - 1 month ago

bruh from Guwahati, India is saying Output of a random number between 0 and 1 is correct answer

Vaibhav Bisht
Vaibhav Bisht - 1 month ago

Vaibhav Bisht from Dehradun, India is saying Output of a random number between 1 and 10 is correct answer

Cos Sinus
Cos Sinus - 1 month ago

Cos Sinus from Casablanca, Morocco is saying Compile time error is correct answer

Souad El
Souad El - 1 month ago

Souad El from Casablanca, Morocco is saying Compile time error is correct answer

Joshua Gama
Joshua Gama - 2 months ago

Joshua Gama is saying Output of a random number between 0 and 1 is correct answer

Related Questions

Which of the following will compile correctly?

  • [A] System.out.println(Math.max(x));
  • [B] System.out.println(Math.random(10,3));
  • [C] System.out.println(Math.round(20));
  • [D] System.out.println(Math.sqrt(10));

Which of these is wrapper for simple data type float?

  • [A] float
  • [B] double
  • [C] Float
  • [D] Double