jilliankaygriff4467 jilliankaygriff4467
  • 04-09-2018
  • Computers and Technology
contestada

Assume that name is a variable of type string that has been assigned a value . write an expression whose value is the first character of the value of name . so if the value of name were "smith" the expression 's value would be 's'.

Respuesta :

hancesoome
hancesoome hancesoome
  • 08-09-2018

For the first question, you would just add the parenthesis to the string mutation1:

String word = "sadly";

String mutation1 = "(" + word + ")";

For the second you need the method substring from the String class:

It is defined as String.substring(begining, ending);

String name = "Smith";

String firstCharacter = name.substring(0, 1);

0 is considered the beginning of the string, then you get the next 1 characters.

Answer Link

Otras preguntas

its fact or opinion drag dealers belong in prison
Something divided by something equals 132
What is a theory that the earths outer shell is not one piece of rock
Container a and b hold 11,875 liters of water altogether. Container b holds 2,391 liters more than container a holds. How much water does container a hold?
The square of a whole number 'n' lies between 80 and 150. Find all possible values for 'n'.
contrast the economies and ways of life that developed in the north and south
Find the x and y-intercepts of the line whose equation is 3x+ 5y=-15
What is the sum of ten and twenty
At the same time a 32-foot water tower casts a 14-foot shadow , a nearby light posts a casts a 7-foot shadow. How tall is the light post? a. 7 ft b. 12 ft c.
how did the puritans get along with kings