String.split() java function help

Your code has several compiler errors - please post your full, formatted code!

Note that String.split takes a regex, so you probably meant something like this:

import java.io.*;

class Main{
	public static void main(String[] args) throws IOException{
        String s="0.123";
        String x[]=s.split("\\.");
        System.out.println(x[0]+" "+x[1]);
	}
}
2 Likes