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
sleet_krkn [62]
3 years ago
12

Write a static boolean method named beginsWithZ. It should accept a String object as a parameter. It should return true if the f

irst character in the String is either of two characters: a capital ‘Z’, or a lowercase ‘z’. (Note: Check the parameter for a null value, and for an empty string. Nulls and empty strings do not start with an ‘z’.)
Computers and Technology
1 answer:
almond37 [142]3 years ago
6 0

Answer:

public static boolean beginsWithZ(String word){

if(string == null || string.length() == 0)

return 0;

if(word.charAt(0) == 'Z' || word.charAt(0) == 'z')

return 1;

else

return 0;

}

Explanation:

This method is a boolean method, meaning it returns true if the string begins with Z or z and false otherwise. So:

The Java command charAt() let's you find the character at each position of the string, so i use it.

public static boolean beginsWithZ(String word){

if(string == null || string.length() == 0)

return 0;

if(word.charAt(0) == 'Z' || word.charAt(0) == 'z')

return 1;

else

return 0;

}

You might be interested in
My sister told me an extremely funny joke. what is the direct object for this sentence ?
bearhunter [10]

Answer:

Explanation:

6 0
3 years ago
What can detect 8 colors?
Semmy [17]
The color sensor if i’m correct
8 0
3 years ago
Read 2 more answers
A word root is used to link a suffix that begins with a vowel. Which of the following words is an example of this rule? Group of
QveST [7]

Answer:

The answer is A.

Explanation:

5 0
4 years ago
Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
rjkz [21]
<span>keeping hands and wrists straight while typing</span>
3 0
3 years ago
Read 2 more answers
Review how to write a for loop by choosing the output of this short program.
Natalija [7]

This for loop will output:

0

2

4

The range(3) is all the integers between 0 inclusive and 3 exclusive. 0, 1, 2.

Every iterations through the for loop, we multiply the value of each number by 2 and print it to the console.

0 * 2 = 0

1 * 2 = 2

2 * 2 = 4

I hope this helps.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Frank works for an organization that wishes to install a software program on a single server with multiple users connected. Whic
    8·1 answer
  • Gary lives in an area that receives a lot of rain throughout the year. which device would be useful to him to maintain his compu
    8·1 answer
  • Match the ocean floor feature with its characteristic.
    6·1 answer
  • What made it possible to develop personal computers?
    10·2 answers
  • Write a method, including the method header, that will receive an array of integers and will return the average of all the integ
    7·1 answer
  • Networks and the interconnectivity of media have affected our society in that:
    13·2 answers
  • The tags are always enclosed within a pair of<br>(a) curly<br>(b) square<br>(©) angular​
    6·1 answer
  • Heyyyyyy<br> byeeeeeeeeeeeeeeeeeeeeeee
    15·2 answers
  • Is hp pavilion pc a digital or analog computer
    8·1 answer
  • A program similar to mtr, ____, is available as a command-line utility in Windows operating systems.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!