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

The formula C = 20x + 5 models the cost of New York Yankees T-shirts, where C is the cost and x is the number of shirts sold. Choose ALL TRUE statements in the
The diameter of your bicycle wheel is 25 inches. How far will you move in one turn of your wheel?
Buck drove 220 miles in 5 hours. What was his average rate of speed?
Buck drove 220 miles in 5 hours. What was his average rate of speed?
Buck drove 220 miles in 5 hours. What was his average rate of speed?
The base of right prism is rhombus of diagonal is 6 and 8cm and altitude is 12 cm find total surface area
Where do the cranial nerves originate? Where do the spinal nerves originate?
How consumers behaviour affect market equilibrium
How do u write 6 more the 7 times a number is 41 in algebraic equation??
The dimensions of a brick that weighs 25 N are 0.19 m × 0.07 m × 0.095 m. What pressure does the brick exert on the ground if it is resting on its largest face?