Consider the following code segment
String str = "a black cat sat on a table";
nt counter = 0;
for (int i = 0; i < ( ) - i; i++)
{
If (str.substring(i, i + 1) equals("a") &&
!str,substring(i + 1, i + 2) equals("b") )
{
counter++;
}
}
Sysmte.out.println
(counter);
What is printed as a result of executing this code?
A. 1.
B. 2
C. 3
D. 5
E. 6