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
crimeas [40]
3 years ago
7

8. Given the array String[] words, which already contains 1 or more values, write a block of code which counts and returns the n

umber of words which start with the letter k
Computers and Technology
1 answer:
Vikentia [17]3 years ago
7 0

Answer:

Following are the code to this question:

public class Main//defining a class

{

public static void main(String[] arg)//defining main method

{

  String[] words={"Key","day", "Know", "kind"};//defining array of String words

  int x=0;//defining integer variable for count value

  for(int i=0;i<words.length;i++)//defining for loop for count value

  {

 if(words[i].startsWith("k")||words[i].startsWith("K"))//use if block to check word start from k

  x=x+1;//increment the value of x

  }

System.out.print("The number of letters which starts from k is: "+ x);//print value with message

}

}

Output:

The number of letters which starts from k is: 3

Explanation:

In this code, inside the main method an array of String "words" is defined that hold a value, and in the next step an integer variable "x" is defined, which is used to count the letters, which starts from k.

For this, a for loop is used that counts the value and in this an, if block is defined that uses the "startsWith" method to check the value and increment the value of x and at the last, it prints its value.

You might be interested in
Which of the following will you select as X in the following series of clicks to lay the title over a chart: Chart Title box &gt
guapka [62]

Answer:

A

Explanation:

We are to lay a title over a chart, which means the position of the title should be above the chart.

When doing this, it will centre the title over the chart without duly interfering with the original size of the chart.

The option 'over chart' is incorrect as it is not a valid selection in the pane. Below chart as well is incorrect as we are to lay the title above the chart.

3 0
4 years ago
QUESTION 5
Zepler [3.9K]

Answer:

allows users to accomplish tasks such as create text documents.

Explanation:

8 0
2 years ago
When talking about careers in designing game art, the unit mentioned that a good portfolio and a clear record of experience in g
atroni [7]

Answer:

Explanation:

Many different answerd to this

I dont know what course your taking exactly but i'll do my best <3

Personnally im most interested in balancing in game rewards, balancing AI, or balancing in game currency.

Hmm... I dont really kno what you could add to your portfolio tho. Maybe some things you did that involve what youre interested in doing.

Hope this helps <3

8 0
3 years ago
Need answer ASAP plz
Natalka [10]

Answer:

i can't read a single word on there i'll come back to it if you can zoom in a little

Explanation:

6 0
3 years ago
How to get out of the verify your identity page on a dell laptop because it won’t let me
motikmotik

lol restart te computer and turn it on again

8 0
3 years ago
Other questions:
  • The internet is an example of
    12·2 answers
  • Write an expression that executes the loop body as long as the user enters a non-negative number.Note: If the submitted code has
    11·1 answer
  • You would like to conduct a survey and ask your web page visitors to indicate the computer operating systems that they use. Each
    10·1 answer
  • What was one complication caused by the tsunami that struck japan in 2011?
    15·1 answer
  • Which statement best describes the purpose of the Insert Function dialog box?
    13·1 answer
  • Imagine that you have a friend who has expressed interest in designing and programming video games. He loves to play video games
    10·1 answer
  • Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links, of rates R1 = 500 kbps, R2
    14·1 answer
  • Write a programmer defined function that compares the ASCII sum of two strings. To compute the ASCII sum, you need to compute th
    6·1 answer
  • First time using this site so be mindful if I make any mistakes
    6·1 answer
  • Helpppppppppppppppppppppppppppppppp
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!