Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExceptionDemo {
- public static void highlightTheI(String in) {
- // The integer below could be equal to minus one
- int x = in.indexOf('i');
- if(x >= 0) {
- System.out.println(in.substring(0, x) + 'I' +
- in.substring(x+1));
- } else {
- System.out.println("There is no i in " + in);
- }
- }
- public static void main(String[] args) {
- String randomWord = "team";
- highlightTheI(randomWord);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment