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]
2 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]2 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
What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
My name is Ann [436]

Answer:

How sensitive the camera is to incoming light.

Explanation:

8 0
3 years ago
Read 2 more answers
Why is there more content on youtube in 4k then there is on cable, satellite, and digital tv combined?
barxatty [35]
So many more people all around the world have easy access to youtube
3 0
3 years ago
Read 2 more answers
Help!! Best answer will get Brainliest!!
Eddi Din [679]

Answer:

answer(s):

-set goals

-select a topic

-write down research questions

Hope this helped and sorry for the bold. <3

Explanation:

6 0
2 years ago
Read 2 more answers
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the follo
Strike441 [17]

Answer: str[0].toUpperCase();

Explanation:

str[0] is pointing to the first character of the entire string and the code str[0].toUpperCase() will convert the characters to upper case if they are in lowercase and will remain unchanged if they are already in upper case.

7 0
2 years ago
The commands on an Edit menu may change as a result of your actions. True or False
cestrela7 [59]
The answer to the question is true
5 0
3 years ago
Read 2 more answers
Other questions:
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • A block style business letter is:
    5·1 answer
  • Sharing a workbook helps to complete ________ (A, tasks) (B,changes) (C, typing) on time. Multiple people acssessing the workboo
    9·1 answer
  • Write a Python program calculate summary statistics about a class assignment. First, prompt the user for the number scores to be
    6·1 answer
  • What percentage of people with internet access use emojis?
    11·1 answer
  • What can search the internet and select elements based on important words
    10·1 answer
  • . Some countries lack physical resources, like computers or network connections, making it difficult to keep up with the technol
    8·2 answers
  • Microsoft words spell checker
    9·1 answer
  • Aranjează următoarele cuvinte din documentul word Proiect, într-o scrisoare în care soliciți directorului școlii sprijin în priv
    8·1 answer
  • HOW TO GET RID OF THESE LINES?? PLS WILL GIVE BRAINLIEST
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!