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
klasskru [66]
4 years ago
9

An array of Strings, names, has been declared and initialized. Write the statements needed to determine whether any of the array

elements are null or refer to the empty String. Set the variable hasEmpty to true if any elements are null or empty-- otherwise set it to false.
This is the code I put in, but it has compile errors
hasEmpty = false;
int k = 0;
for (k = 0; k < names.length; k++)
{
if ((names[k] == null) || (names[k].equals("")))
hasEmpty = true;
}
Computers and Technology
1 answer:
Ghella [55]4 years ago
3 0

Answer:

boolean hasEmpty = false; //This is line which have compile time error and which is modified.

int k = 0; //Taken from the question.

for (k = 0; k < names.length; k++)// Taken from the question.

           {//Taken from the question

               if ((names[k] == null) || (names[k].equals("")))//Take from the question.

                hasEmpty = true; //taken from the question.

              }//Taken from the question.

Explanation:

  • There is one line which gives the compile-time error and that is in the "hasEmpty = false;" statement because there is no any data type defined for this value, so when we write the code in the java language, then we need to define it like " boolean hasEmpty = false; ".
  • The above answer is in java language because there are "names.length" which is used in java and the string data type is also used in java which is defined in the question.
You might be interested in
How can a user begin to work with a new sheet in excel?
Hitman42 [59]
I hope I'm answering this correctly I'm not too smart about it so I hope that sounds right if you arewanting to start with a new sheet in excel do one of the following click the new sheet button on the screen. now if you want to insert a new worksheet in front of its system worksheet and then click Home>insert> insert sheet. also Excel gives you three worksheets in a workbook, you can add much more worksheets and of course other types of sheets examples are micro sheet or dialog sheet. then you can rename them or delete them. so you can give any work sheet any name you want. sheets are displayed by default but if you don't see them click options>adcanced> display for options for the worksheet> show sheet tabs.
3 0
3 years ago
Which term refers to actions that you would typically perform on a computer to revive it if it functions in an unexpected manner
andriy [413]
There are many answers to this question. The first step is normally a reboot, second, I would check witch task or service is taking up all the CPU cycles and check the system and error logs. The list goes on... I'm not sure how detailed you want to get.
5 0
4 years ago
Read 2 more answers
A _____ stores definitions, such as data types for fields, default values, and validation rules for data in each field.
PIT_PIT [208]
The answer to this question is the term Data Dictionary. A Data Dictionary or also known as metadata repository is a set of information that is stored which contains data, meanings, and values. The data dictionary can be used as a tool for communication between the stakeholders.
5 0
3 years ago
Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a d
Rudik [331]

Answer:

import java.io.*;

public class Main {

   public static void main(String[] args) throws IOException {

       double baseLength = 0, baseWidth = 0, pyramidHeight = 0;

       Object[] volume;

       volume = calcPyramidVolume(baseLength, baseWidth, pyramidHeight);

   }

   public static Object[] calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight) {

       double area = calcBaseArea(baseLength, baseWidth);

       double volume = baseLength * baseWidth * pyramidHeight;

       return new Object[]{volume, area};

   }

   public static double calcBaseArea(double length, double width) {

       return length * width;

   }

}

Explanation:

The problem is flawed because it is completely inefficient for one to create two separate methods to calculate the volume and the area when they can be done at once.

The second problem is that it was never specified whether to return something from the calcBaseArea method.

I assumed it required it, so it is not advisable to initiate the method as a double, but rather create it as an Object so that it can return two values: the volume and the area.

6 0
3 years ago
Hi what is full form of ugst​
AURORKA [14]

Answer:

UGST – Union Territory Goods & Services Tax.

4 0
3 years ago
Read 2 more answers
Other questions:
  • You are asked to install a device that will combine several connections to the Internet and provide the sum of the available net
    8·2 answers
  • Ask the user to enter a number n &gt;= 1. There after the user will enter n-1 distinct integers between 1 and n. Thus, the enter
    9·1 answer
  • What is the result when you run the following program?
    12·1 answer
  • Define an I/O port. Which functions are performed by it?
    10·1 answer
  • It takes 2.5 yards of material to make a dress harleys clothing design estimates that they can produce 48 dresses each week.if t
    15·2 answers
  • There are many modes of remote visual communication. which is the most common mode
    5·1 answer
  • Cash cows are always in
    7·1 answer
  • Assume an ArrayList and a Linked List each contain 10,000 items. Which operation is performed fastest
    14·1 answer
  • Which of the following is NOT a file format used for word processing documents? A. .ppt B. .rtf C. .doc D. .odt
    5·1 answer
  • Try to crack the code:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!