Note that there are some explanatory texts on larger screens.

plurals
  1. POincompatible type of double array and properties string.split()
    primarykey
    data
    text
    <pre><code>public static void main(String[] args) { String input="jack=susan,kathy,bryan;david=stephen,jack;murphy=bruce,simon,mary"; String[][] family = new String[50][50]; //assign family and children to data by ; StringTokenizer p = new StringTokenizer (input,";"); int no_of_family = input.replaceAll("[^;]","").length(); no_of_family++; System.out.println("family= "+no_of_family); String[] data = new String[no_of_family]; int i=0; while(p.hasMoreTokens()) { data[i] = p.nextToken(); i++; } for (int j=0;j&lt;no_of_family;j++) { family[j][0] = data[j].split("=")[0]; //assign child to data by commas StringTokenizer v = new StringTokenizer (data[j],","); int no_of_child = data[j].replaceAll("[^,]","").length(); no_of_child++; System.out.println("data from input = "+data[j]); for (int k=1;k&lt;=no_of_child;k++) { family[j][k]= data[j].split("=")[1].split(","); System.out.println(family[j][k]); } } } </code></pre> <p>i have a list of family in input string and i seperate into a family and i wanna do it in double array family[i][j].</p> <p>my goal is:</p> <pre><code>family[0][0]=1st father's name family[0][1]=1st child name family[0][2]=2nd child name and so on... family[0][0]=jack family[0][1]=susan family[0][2]=kathy family[0][3]=bryan family[1][0]=david family[1][1]=stephen family[1][2]=jack family[2][0]=murphy family[2][1]=bruce family[2][2]=simon family[2][3]=mary </code></pre> <p>but i got the error as title: in compatible types found:java.lang.String[] required:java.lang.String family[j][k]= data[j].split("=")[1].split(",");</p> <p>what can i do?i need help</p> <p>nyone know how to use StringTokenizer for this input?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload