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
Question 4 (Multiple Choice Worth 5 points)
pentagon [3]

Answer:

A. append()

Explanation:

I don't know python fully but i do know what stuff means

Print: display text

Main: basically the roots of the entire code

Sort: it's in the freaking name

so crossing out 3 of the 4 its safe to assume its append.

4 0
3 years ago
SUB2 WWolfPlays on yt <br><br><br> true or false if false ima cri
VMariaS [17]

Answer:

True

Explanation:

Plz brainlist

5 0
2 years ago
Read 2 more answers
PPPLLLLEEEEAAASSSSEEEEE HHELLP me.Does anyone know how to copy an image onto a thing so i can post a real question on brainly. b
Kitty [74]
If you're using a computer, you can take a picture on a camera, copy the picture to your computer to upload to Brainly.

If you're using a phone, you can easily upload pictures in the brainly App when you ask a question! just hit the camera button on the bottom left.
8 0
3 years ago
Read 2 more answers
Will give Brainiest and stuff to right answer[s].
Aneli [31]
#22 is 1s and 0s, hope that helps a little bit
6 0
3 years ago
Read 2 more answers
​some forms use a _____ that contains icons or buttons that represent shortcuts for executing common commands.
Galina-37 [17]

GUI, AKA Graphical User Interface

3 0
3 years ago
Other questions:
  • Mark, David, Tia, and Ashley are team members in a computer programming class. They have been assigned the task of creating a co
    12·1 answer
  • Discuss anomaly detection.
    5·1 answer
  • give your opinion on if you would trust your accounts with an online bank. Explain why or why not. MANY people do not. MANY peop
    14·2 answers
  • The Fibonacci numbers are the numbers
    15·1 answer
  • What is the Default path for SYSVOL?
    14·1 answer
  • What is a traffic controller?what are its functions?
    13·1 answer
  • Does Buzz or APEX shows all your due assignments on the left of the main home screen?
    11·1 answer
  • Modify the NumberedList class we implementd during the lecture by adding a member function: void NumberedList::insertPosition(in
    13·1 answer
  • Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a
    7·1 answer
  • PLEASE HELP
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!