Which of the following shows the header for a method that accepts a double value and returns a double? public static void sqrt(double num) public static double sqrt(25) public static double sqrt(double 25) public static double sqrt (double num) I'm pretty positive that "public static double sqrt (double num)" is the correct answer but I don't know for sure.
@AlexandervonHumboldt2
@Directrix
@DanJS
@Godlovesme
sorry idk :( @Nnesha @sleepyjess @jim_thompson5910 help
lol
Java~ Such a wonderful thing to try and start and finish in a single week
ummmmm I have no idea what all that means... sowwy :(
idk about the "public static" part, but luckily that's in each answer choice the format for a function/method header is <return type> <function name>(<argument type>) http://www.homeandlearn.co.uk/java/java_methods.html
hmm...
yea I knew that that's kinda why I went with the fourth answer. Does it seem like a reasonable answer to you @jim_thompson5910 ...?
yes the others are either missing key things or have 25 (which is a constant, not a variable) in them
It's always a little difficult for me to be 100% correct cause there aren't a ton of things online about constructing lines of code online. Most of the things are over the counter books that don't always have the best explanations
Would you mind looking over a few more questions?
A) public static void sqrt(double num) is missing the return type of double ------------------------------------------------------- B) public static double sqrt(25) the input is 25, which is a constant, when it should be a variable ------------------------------------------------------- C) public static double sqrt(double 25) the input type is given, but it's still a constant ------------------------------------------------------- D) public static double sqrt (double num) both return type and argument type are given to be doubles
ok, just a few more, but no guarantees since I'm not really fluent in Java
That's alright :) I just want a second opinion. I'm not looking for indefinite answers.
Join our real-time social learning platform and learn together with your friends!