I have splited
a string and from the recieved string i am trying to form a word everything is comming fine but everytime i get null
string in the first index
why?
Here is my code:
String assetClasses = "Gold:Stocks:Fixed Income:Commodity:Interest Rates";
String[] splits = assetClasses.toString().split(":");
//System.out.println("splits.size: " + splits.length);
String ab = null;
for(int i=0; i<splits.length;i++){
System.out.println(splits[i]);
ab+=splits[i];
}
System.out.println(ab);
The output:
Gold
Stocks
Fixed
Income
Commodity
Interest Rates
nullGoldStocksFixed IncomeCommodityInterest Rates