The problem is that sometimes I, like others, don't know we're doing it wrong.
I didn't realize I could get kicked out for giving advice, especially advice that seems to make sense to me at the...
Type: Posts; User: javapenguin
The problem is that sometimes I, like others, don't know we're doing it wrong.
I didn't realize I could get kicked out for giving advice, especially advice that seems to make sense to me at the...
String rollNumber = console.nextLine();
String number = rollNumber.substring(3);
Where do you want them stored at in the array?
Also, I don't know what:
System.out.print("Enter the size of the array s: ");
size = scan.nextInt();
System.out.println("size is :" + size);
String[][] arr = new...
It should be
System.out.println(rollnumber.split("IAD")[0]);
I see now that the 0 would be index 0 of the array the split method is creating.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
Doesn't seem right to me, with the [] around the 1.
If anything, it'd be split("IAD", 1);
Actually, it could be
System.out.println(Arrays.toString(rollnumber.split("IAD", 1)));
Also, your for loop will change letter found the first time it finds the letter and it'll still be true for the next iteration of your for loop.
System.out.println(rollnumber.split("IAD")[1]);
You're printing an array?
Also, I'm positive that's invalid syntax.
It's
public String[] split(String regularExpression)
{