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
lyudmila [28]
2 years ago
5

Hello pls answerwhat is the use of loop in java​

Computers and Technology
1 answer:
xxMikexx [17]2 years ago
7 0
The use of loop in java is to run a block of code for a certain number of times.
You might be interested in
What are the sectors of the buisness enviornment
Alinara [238K]

Answer:

The external business environment consists of economic, political and legal, demographic, social, competitive, global, and technological sectors.

4 0
2 years ago
Which of the following is a career that's indirectly linked to careers in web technologies?
leva [86]

Answer:

that would beA

Explanation:

7 0
3 years ago
What changes could you make so that a message, "User input deemed invalid." during designing a simple calculator program for you
Afina-wow [57]

The most appropriate change in this situation would be to change the message "User input deemed invalid" to "You made a mistake, try again, you can".

<h3>What should we change to improve the children's experience?</h3>

To improve children's experience with this new calculator program, we must adapt all the features of the program for children's users. Therefore, the buttons, the messages and everything related to this program must be suitable for their motor and brain development.

Therefore, it is considered that the message "User input deemed invalid" is not suitable for children because they may not understand this message or misinterpret it and desist from using the new program.

So, the most appropriate message to replace the previous message would be:

  • "You made a mistake, try again, you can"

Because this message is suitable for the friendly language that children use in their daily lives and they would better understand the message without giving up using the new program or the calculator.

Learn more about programs in: brainly.com/question/13264074

#SPJ1

3 0
1 year ago
Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order. Write a static meth
telo118 [61]
Since both arrays are already sorted, that means that the first int of one of the arrays will be smaller than all the ints that come after it in the same array. We also know that if the first int of arr1 is smaller than the first int of arr2, then by the same logic, the first int of arr1 is smaller than all the ints in arr2 since arr2 is also sorted.

public static int[] merge(int[] arr1, int[] arr2) {
int i = 0; //current index of arr1
int j = 0; //current index of arr2
int[] result = new int[arr1.length+arr2.length]
while(i < arr1.length && j < arr2.length) {
result[i+j] = Math.min(arr1[i], arr2[j]);
if(arr1[i] < arr2[j]) {
i++;
} else {
j++;
}
}
boolean isArr1 = i+1 < arr1.length;
for(int index = isArr1 ? i : j; index < isArr1 ? arr1.length : arr2.length; index++) {
result[i+j+index] = isArr1 ? arr1[index] : arr2[index]
}
return result;
}


So this implementation is kind of confusing, but it's the first way I thought to do it so I ran with it. There is probably an easier way, but that's the beauty of programming.

A quick explanation:

We first loop through the arrays comparing the first elements of each array, adding whichever is the smallest to the result array. Each time we do so, we increment the index value (i or j) for the array that had the smaller number. Now the next time we are comparing the NEXT element in that array to the PREVIOUS element of the other array. We do this until we reach the end of either arr1 or arr2 so that we don't get an out of bounds exception.

The second step in our method is to tack on the remaining integers to the resulting array. We need to do this because when we reach the end of one array, there will still be at least one more integer in the other array. The boolean isArr1 is telling us whether arr1 is the array with leftovers. If so, we loop through the remaining indices of arr1 and add them to the result. Otherwise, we do the same for arr2. All of this is done using ternary operations to determine which array to use, but if we wanted to we could split the code into two for loops using an if statement.


4 0
3 years ago
I need to create a method named "root positive". which will either print the square root of the number passed to it or if the nu
rjkz [21]

Answer:

Explanation:

The following code is written in Java. It is a method that calculates the square root of a number as requested. The method first checks with an IF statement if the parameter value is a positive number and then calculates the square root and prints it to the screen. Otherwise, it prints Number must not be negative. A test case has been provided in the main method and the output can be seen in the attached image below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.print("Enter a number of type double to calculate square root:");

       double num = in.nextDouble();

       rootPositive(num);

   }

   public static void rootPositive(double num) {

       if (num > 0) {

           System.out.println(Math.sqrt(num));

       } else {

           System.out.println("Number must not be negative.");

       }

   }

}

5 0
3 years ago
Other questions:
  • PLEASE HELP!!!!! MUCH OBLIGED!!!!
    15·1 answer
  • Look up and list the number of a local taxi or car service in your community. Include the company name and telephone number.
    13·1 answer
  • How should font appear in a slide presentation compared to the font in a document
    7·1 answer
  • Write a program that declares a constant named QUARTS_IN_GALLON which holds the number of quarts in a gallon (4). Also declare a
    8·1 answer
  • Security Definition updates for windows defender are performed through the ——— function in windows server 2016
    7·2 answers
  • Name various phases of SDLC in Rational Unified Process (RUP)
    7·1 answer
  • Sharon must give an informative presentation to a group of teenagers about cultivating earthworms for use in home gardening. Whi
    11·2 answers
  • HELP I SUCK IN THIS HELP!!!!! ​
    13·1 answer
  • Draw
    7·1 answer
  • Non linear editing can cause _____ where edit and re-edit and re-edit again can cause video to be less true than the original ma
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!