Question: Which code to check whether the following string is not empty, then, If it is not empty, prints the last 5 characters of the string.

 Which code to check whether the following string is not empty,

Which code to check whether the following string is not empty, then, If it is not empty, prints the last 5 characters of the string. Stringstr="Thisstringisnotempty"; if(!str.isEmpty()) \{ System.out.println(str.substring(str.length()-5, str.length())); \} if(str.isNotEmpty()) \{ System.out.println(str.substring(str.length()-5, str.length()-1)); \} if(!str.empty()) \{ System.out.println(str.substring(str.length()-6, str.length())); \} if(!str.isEmpty()) \{ System.out.println(str.substring(str.length()-6, str.length()-1)); \}

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!