Question: 1) Assuming you have the following declarations: (10 points) String name - John James Harrison, MD; What would each of the following sets statements do?
1) Assuming you have the following declarations: (10 points) String name - "John James Harrison, MD"; What would each of the following sets statements do? a. System.out.printin( name.charAt( 15 )); b. System.out.printin( name.substring( name.lastindexOf(): c. int pos = name:indexOf( "Th System.out.printin( name.substringl pos, name.indexOf(', pos+1))) d. int pos name.length)/2; System.out.println( name.charAt(0) ++ name.charAt(pos) +name.charAt( name.length()-1); e. String newName-name.replace('a', '&'); System.out.printin( newName)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
