User input a number such as 1234569775
of 10 digit. may on of the digit has a Value of X and this mean its equal to number 10 SO i write my code
Scanner in=new Scanner(System.in);
String a=in.next();
String arr[]=new String[10];
for (int i=0;i<arr.length;i++)
{
arr[i]=String.valueOf(a.charAt(i));
}
for (int i=0;i<arr.length;i++)
{
if (arr[i]=="X")
{
arr[i]="10";
}
}
System.out.println(Arrays.deepToString(arr));
}
but its the value of X does not change and I try to make a new array and does not make any change too
last thing i want to change this String array all value in it to Integer so I can make any Mathematical operation on them
So I want
- Change value of X to 10
- Change the array values to Integer
How can I do that in Java?