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
Who conceptualizes the design and the working of a website
Citrus2011 [14]
Answer is "Web Designer".

Web Designers are the "artists" of the website. They conceptualize the layout and functionality of the site, from features to format. They may do little coding, and are mostly involved in the creative elements of web design. The Web Developer is less big-picture, and more knitty-gritty building of the website. She is the one who does the coding and actually builds the website, using the web designer's model. 
3 0
4 years ago
TRUE/FALSE: In order to use an object in a program, its class must be defined.
FinnZ [79.3K]
Yes that is correct. True
3 0
3 years ago
Explain: The decode part of fetch decode execute cycle
egoroff_w [7]

Answer:

Image below

Explanation:

5 0
3 years ago
Read 2 more answers
"If someone really wants to get at the information, it is not difficult if they can gain physical access to the computer or hard
Jobisdone [24]

Answer:

It is  just true in most cases

Explanation:

This statement is just true in most cases because in some cases having a physical access to the computer or hard drive this does not guarantee access to the information contained in the hard drive or computer because the data/information in the hard drive or computer might as well be encrypted and would require a password in order to de-crypt the information.

Having a physical access is one step closer in some cases but not the only step required .

4 0
3 years ago
What command line utility can be used to repair the bcd on a windows installation?
Afina-wow [57]
You can use the following command Bootrec /rebuildbcd
8 0
3 years ago
Other questions:
  • Pointsyour company environment includes windows server versions 2003, 2008, and 2012. desktops range from windows xp and vista.
    13·1 answer
  • When driving, your attention is __________.
    5·2 answers
  • Which group of commands all appear on the Standard toolbar?
    9·2 answers
  • Cloud kicks recently completed the implementation of sales cloud. Cloud kicks has trained the users to use the mobile app to acc
    12·1 answer
  • A communication medium which allows receivers to observe multiple cues, such as body language and tone of voice, and allows send
    15·1 answer
  • A ddr4 dimm with a pc rating of pc4-17000 is running at what speed?
    15·1 answer
  • Describe at least three virus scanning techniques
    13·1 answer
  • Size of the information in each field of the database
    12·1 answer
  • Jonathan works with a team of graphic designers. They have a collection of images and have divided the image editing work among
    5·2 answers
  • 1. Which sentence best expresses the main idea
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!