Question: public class Substrings { public static void main(String[] args) { String str = Programming in Java is fun!; // your code goes here } }

public class Substrings { public static void main(String[] args) { String str = "Programming in Java is fun!"; // your code goes here } }

/* a. Extract the second word in the string using the .substring() method. */ String sub1 = "Replace this text with your answer."

/* b. Extract the last word in the string, but not the punctuation, using the .substring() method. */ String sub2 = "Replace this text with your answer."

/* c. Extract the word Java in the middle of the string using the .substring() method. */ String sub3 = "Replace this text with your answer."

/* d. Extract all but the first character of the string using the .substring() method. */ String sub4 = "Replace this text with your answer."

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!