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
Ne4ueva [31]
4 years ago
15

public class Ex0506 { public static void main (String args[]) { int x = 2; while (x < 10) { if (x % 2 == 0) x+=3; else x+=2;

} System.out.println("x = " + x); } }
Computers and Technology
1 answer:
olga nikolaevna [1]4 years ago
5 0

Answer:

It will print x = 11

Explanation:

x starts with a value of 2 and goes inside the while loop. The loop will continue until x<10. Inside the loop, If x is even number, 3 will be added to x. Otherwise, 2 will be added. When the loop is done, x will be printed.

First iteration:

x = 2, x becomes x + 3 = 5, Is x smaller than 10? YES

Second iteration:

x = 5, x becomes x + 2 = 7, Is x smaller than 10? YES

Third iteration:

x = 7, x becomes x + 2 = 9, Is x smaller than 10? YES

Forth iteration:

x = 9, x becomes x + 2 = 11, Is x smaller than 10? NO

Stop the loop and print x

You might be interested in
What is the primary purpose of the destination address?
ehidna [41]

Answer:

The answer to this question is given below is the explanation section.

Explanation:

"A" option is correct

    It helps the router know where to send the packet.

4 0
3 years ago
LAB: Convert to binary - methods
Georgia [21]

Answer:

import java.util.Scanner;

public class Lab{

  public static String integerToReverseBinary(int number)

  {

      String binary = "";

      if(number == 0){

          return "0";

      }

      while(number > 0)

      {

          int remainder = number % 2;

          number = number / 2;

          binary += Integer.toString(remainder);

      }

      return binary;

  }

 

  public static String reverseString(String wordString)

  {

      String binaryString = "";

      int length = wordString.length();

      for(int i = length -1 ; i >= 0 ; i--)

      {

          binaryString += wordString.charAt(i);

      }

      return binaryString;

  }

 

Explanation:

In the java source code, the Lab class is defined which has two methods, 'reverseString' and 'integerToReverseBinary'. The latter gets the argument from the former and reverses the content of its string value, then returns the new string value. The former gets the integer value and converts it to its binary equivalence for which are converted to strings and returned.

8 0
3 years ago
Hi i choose brainlyest 4 free
irinina [24]

Answer:

bet

Explanation:

7 0
3 years ago
Read 2 more answers
Write a Racket two-way selection structure that will produce a list '(1 2 3) when the first element of a list named a_lst is ide
ANEK [815]

Answer:

A

Explanation:

3 0
3 years ago
In this section of your final project, you will write a basic script to create and back up files. You will create this script wi
Viktor [21]

Answer:

bjdjdindbdubduf kndjnxjxjfujdjbdjbd bzjbd djbdibdu jdjdidnidndi xubdubdufjksk. xud ufbsjjdi djneibdudbdujfjfbjbdj fu. fjfjjdubdjjdbjd jdbdinkdkdnd. djjdibnfjdkndindundi jdudjbdubd djbdu bdudjdjjd djidndud dudbid anís us dj

4 0
3 years ago
Read 2 more answers
Other questions:
  • When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the
    15·1 answer
  • If a movie starts at 305 and the movie is 2 hrs and 44 mins when does the movie end?
    14·1 answer
  • Your colleagues are discussing the operation of a device in which packets are routed between VLANs on the device rather than hav
    7·1 answer
  • The next thing Maria wants to do is to indent the first line of her paragraph how dose she do it
    10·2 answers
  • Given the following program: public class MysteryNumbers { public static void main(String[] args) { String one = "two"; String t
    13·1 answer
  • Which principle suggests that specific single responsibility interfaces are better than one general purpose interface?
    13·1 answer
  • A systems administrator is designing a directory architecture to support Linux servers using Lightweight Directory Access Protoc
    11·1 answer
  • Because a chart is _______, it can be dragged to another area of the worksheet.
    13·1 answer
  • Why there isn't in italian this app?​
    15·1 answer
  • Add me on Pokemon go, my trainer code is 5584 3300 5313
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!