0

making json polymorphism;i can make the arrays for each objects strings or integers but i couldn't hold the all strings or integers for one object. can you give me a simple example for creating a new json polymorphism.

public class jsonvalue {

jsoninteger []jinteger;
jsonstring []jstring;

String [] s;
int i=0;
int p=0;

  public jsonvalue()
{ 
jinteger=new jsoninteger[100];
jstring =new jsonstring[100];
s=new String[100];
} 
  public void add(String x,jsonstring a){

      s[i]=x;
      jstring[i]=a;
      i++;

  }
  public void add(String x,jsoninteger b){

      s[i]=x;
      jinteger[p]=b;
      i++;
      p++;
  }
}
Sébastien
  • 11,860
  • 11
  • 58
  • 78

0 Answers0