InterviewSolution
Saved Bookmarks
| 1. |
Write a statement each to perform the following task on a string : (i) Find and display the position of the last space in a string s. (ii) Convert a number stored in a string variable x to double data type. |
|
Answer» (i) String s = “this is to test”; int p; p = s. lastIndexOf (“ ”); System.out.println(p); (ii) String x = “10.2”; double d; d = string.valueOf (x); |
|