1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nonamiya [84]
3 years ago
6

Consider the following code: public static void mystery(int a) { System.out.println("A"); } public static void mystery(double a)

{ System.out.println("B"); } public static void mystery(int a, double b) { System.out.println("C"); } public static void mystery(double a, int b) { System.out.println("D"); } What is output by the following? mystery(7);
Computers and Technology
1 answer:
Feliz [49]3 years ago
3 0

Answer:

The output is "A"

Explanation:

public class Solution {

   public static void main(String args[]) {

     mystery(7);

   }    

   public static void mystery(int a) { System.out.println("A"); }    

   public static void mystery(double a) { System.out.println("B"); }    

   public static void mystery(int a, double b) { System.out.println("C"); }    

   public static void mystery(double a, int b) { System.out.println("D"); }

}

In the code above; mystery is defined in four different ways called method overloading. Method overloading is when same method is defined with different parameters.

In the first case; mystery will be called if the argument is int.

In the second case; mystery will be called if the argument is double.

In the third case; mystery will be called if the arguments are int and double.

In the fourth case; mystery will be called if the arguments are double and int.

When mystery(7) is called; the mystery method requiring only int will be called and the output is "A".

You might be interested in
Write a program that prints the Grade based on the given data. 95-100: A+ 90-94: A 80-89: B+ 70-79: B 60-69: C+ 50-59: C <49
mr Goodwill [35]

Answer:

The program to this question as follows:

Program:

score=int(input("Enter your percentage: ")) #input grade by user

#using conditional statement for match condition  

if 95<=score <= 100: #if value in between 95 to 100

   grade = 'A+' #assign grade

elif 90 <=score <= 94: #elif value in between 90 to 94

   grade = 'A' #assign grade

elif 80 <=score <= 89:  #elif value in between 80 to 89

   grade = 'B+' #assign grade

elif 70 <=score <= 79:  #elif value in between 70 to 79

   grade = 'B' #assign grade

elif 60 <=score <= 69:  #elif value in between 60 to 69

   grade = 'C+' #assign grade

elif 50 <=score <= 59:  #elif value in between 50 to 59

   grade = 'C' #assign grade

elif score<49 :  #elif value is less then 49

   grade = 'F' #assign grade

print (grade) #print grade

Output:

Enter your percentage: 50

C

 Explanation:

In the above python code, a variable "score" is defined, this variable is used for taking value from the user end. In the next step if-elif-else conditional statement is used, this statement is used when a group of statements is given in which one is true. The if block check score value is between 95-100 if this is true it will print A+.

In elif block if the above condition is not true, then this condition will execute, in this block, there are multiple elif block is used that can be described as follows:

  • In the first block, if the value in between 90-94. It will print A.
  • In the second block, if the value in between 80-89. It will print B+.
  • In the third block, if value in between 70-79. It will print B.
  • In the fourth block, if value in between 60-69. It will print C+.
  • In the fifth block, if value in between 50-59. It will print C.
  • In the last, if the value of the score is less then 49. It will print F.
8 0
2 years ago
What’s the purpose of balancing or monitoring your checking account?
emmasim [6.3K]
B) To help you calculate how much money you have in your account.
3 0
3 years ago
Read 2 more answers
What frequency band is used by bluetooth, 802.11b, and 802.11g?
bagirrra123 [75]
802.11 is a Wi-Fi standard, not a frequency, both of those operate at 2.4 GHz. Bluetooth operates at frequencies between 2402 and 2480 MHz, or 2400 and 2483.5 MHz. 
4 0
3 years ago
Which term is used to identify the connection of computers that are physically close to one another?
marta [7]

Answer: Local Area Network (LAN)

Explanation:

A Local Area Network (LAN) is a computer network that interconnects computers within a limited physical area such as a residence, school, laboratory, university campus or office building.

An example of  LAN network is "Phone, Computer and TV connected to a single network (such as a Home Network) via Cables, Wifi, Bluetooth or Hotspot". When the devices are interconnected or connected to a LAN, it becomes accessible between each other.

A simplest example of a LAN Device is a <em>Home Router.</em>

6 0
3 years ago
Read 2 more answers
What appears in the document after you have inserted a video?
Nitella [24]

Answer:

text with a hyperlink to the video website

Explanation:

documents do not auto-upload thumbnails or embedded videos for playback, so external links are pasted there

6 0
2 years ago
Read 2 more answers
Other questions:
  • A size of a jumbo candy bar with rectangular shape is l x w x h. Due to rising costs of cocoa, the volume of the candy bar is to
    9·1 answer
  • Which loan type requires you to make loan payments while you’re attending school?
    10·1 answer
  • How to go to a website with an ip address?
    15·1 answer
  • Which Supreme Court case resulted in a decree issued for the Michigan Department of Corrections to provide female inmates access
    10·1 answer
  • Translate the following C program into an assembly program. The C program finds the minimal value of three signed integers. Assu
    13·1 answer
  • ____________________ is the primary code humans use to communicate. (Points : 1
    9·1 answer
  • it says i have brainly plus subscripton but whenever i log onto brainly using my laptop, it says i don't have brainly plus and w
    12·1 answer
  • What does Al stand for?
    10·1 answer
  • Write a method named lastIndexOf that accepts an array of integers and an * integer value as its parameters and returns the last
    15·1 answer
  • Need help plz 100 POINTS
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!