is there something wrong in this code written in java? : the actual answer is supposed to be "stack" and "overflow" in two separate lines for input "stack.overflow".delimiter used is ".".
nothing is shown in the output

Scanner p=new Scanner(System.in);

p.useDelimiter(".");

System.out.println("delimiter is "+ p.delimiter());

\\this above line is producing expected output

while(p.hasNext()){

            System.out.println(p.next());

        }

for input stack.overflow and delimiter "."
expected output is stack
                   overflow


