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

what is the most work that can be done with 100 joules if energy
PLEASE HELP I GIVE THANKS
What happens to a white light passes through a prism?
Resolve the following two forces into horizontal and vertical components.
Fern ir read 5/7 of the pages in his 98 page book.how many pages does he have left?
If a solution is made by mixing 50.0 moles of KOH to 3.4 kilograms of water then what is the solutions molality?
Which of the following features is found in an insect? indeterminate embryonic cells radial cleavage in embryonic cells coelom formed by a split in the mesoderm
Explain how heat is transferred inside the earth through convection currents
Blain exchanges $100 for yen before going to Japan. If each U.S. dollar is worth 88.353 yen, how many yen should Blain receive?
What is the interest earned at $700 at 8% for 6 years