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
ankoles [38]
4 years ago
5

Brainiest To Best Answer!! Java coding help, can you tell me what Switch and Case does using the example below?

Computers and Technology
1 answer:
fiasKO [112]4 years ago
4 0
The switch statement is an n-way branch. An n-way branch can branch to any of an arbitrary number ( n ) of branches. An if statement can branch two ways, whether the condition is true or false.

The example you gave is a great example of how how code is written can make the code make sense or not.

public void setQuiz( int quiz, int grade )
{
  switch( quiz )
  {
    case 1: // if quiz == 1
      grade1 = grade; //where was grade1 declared?
      break;  // otherwise execution will continue through the next case block
    case 2: // if quiz == 2
      grade2 = grade;
      break;
  }
}

The variable named in the switch statement is tested against each case statement and whichever case statement's value matches, the rest of the switch statement's code is executed. (That's why the break statements are needed) Usually switch statements are written with a default case at the end as a "catchall".
You might be interested in
Assume that a file containing a series of integers is named numbers.dat and exists on the computer's disk. design a programt hat
REY [17]
This is what I got so far, I hope this helped you!

8 0
3 years ago
Read 2 more answers
The technology that identifies people through bodily characteristics is known as
vlabodo [156]
C. Biometrics, examples of common biometric devices are finger print scanners (iphones, phones, laptops etc..) and pupil scanners.  
3 0
3 years ago
Td udutdiydiyfyfigciydutdutdtt
luda_lava [24]

hghsFHSkuhsdggewyewGUKweutgqeYFGYhgsukGFwufYHFUKyfukyfeukfrgkufwrGwukfrgtuskgtweYRtueoytewiuWYI7W

5 0
3 years ago
Read 2 more answers
What is the legal right granted to all authors and artists that gives them sole ownership and use of their words, software, pict
ICE Princess25 [194]

Answer:

copyright

Explanation:

3 0
4 years ago
On the cities worksheet, click cell f4 and enter a formula that will subtract the departure date (b1) form the return date (b2)
Mademuasel [1]
=(+B2-B1)*F3 is what you need to enter in cell F4
8 0
3 years ago
Other questions:
  • Obtain the 10’s complement of the following six-digit decimal numbers:<br><br> 123900<br><br> 980657
    10·1 answer
  • hardtack was a. a new cone-shaped bullet. c. a type of biscuit. b. a sharp turn made on command. d. a type of body armor.
    6·1 answer
  • ________ is the presentation of information to the user and the acceptance of the user’s commands. a.data storageb.data access l
    7·1 answer
  • Pablo can view a minimum of_____ panes and a maximum of_____ panes in a split screen worksheet.
    7·1 answer
  • Xbrl taxonomy: is the document format used to produce web pages. is the final product (report. is a classification scheme. is a
    12·1 answer
  • What takes information entered into a given system and sends it automatically to all upstream systems and processes?
    6·2 answers
  • Give four examples of devices which are both<br>Input and Output to a Computer.​
    12·1 answer
  • While reviewing system logs, a security analyst notices that a large number of end users are changing their passwords four times
    13·1 answer
  • A line graph is a great tool for showing changes over time. Why is a line graph better than other graphs at showing this type of
    6·1 answer
  • Accept total number of participants (B) in class. A group of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!