Using Java , please help me solve this quick 4 questions Home FAQ About Log inS
ID: 3706960 • Letter: U
Question
Using Java , please help me solve this quick 4 questions Home FAQ About Log inS Subscribe now 30-day free trial Reading Quiz 5 Friday 4/13 This reading quiz is due at 7:50 am on Friday 4/13. This quilz will have ONLY 3 attempts. "Refresh Backspace or "Closing Tab" will be counted as an attempt. So PLEASE be careful, you will NOT get extra attempts O All of the above ? linporttheRandomidass O Create a header 2 What should be the return type of the following method? (Fll in the blank with the appropriate return type) publieadd(int a, int b)f double e-ab return ej (1 point) O int O boolean 3. What are the possible values for a after the following code is run? 2 3 4 6 Q?WExplanation / Answer
Ans 1. Option B (->import the Random class)
Explanation:
import java.util.*;//Import a random class like this
Random rand = new Random();//use Random class like this
int a = rand.nextInt();//any respective method of random class can be used here.
Ans 2. Option C(->double)
Explanation:
As method is returning the result of addition as double, so we have to return double in this case. Result of addition of two integers can be a double number but vice -versa is not possible.
Ans 3. Option D( ->0-5)
Explanation:
nextInt (int n) method of Random class in java generates a random number between 0 to n that is the parameter so passed.
Ans 4. Option D( ->turtle.method("Apple",5) )
Explanation:
Here method is asking for two parameters, one as string and the other one as int so 4th one is the only option satisfying the same.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.