I am trying to split a String from an array into multiple Strings, before and after the "^". I used the String split method, but it is just storing the whole String in the first value of the array.
Output: b[0]= x^2 Expected: b[0] = x , b[1] = 2
Here is the code:
public class test { public static void main(String[] args) { String a[] = {"x^2"}; String b[] = a[0].split("^"); System.out.println(b[0]); } }