Can someone please tell me what the tokens are for in this code? I've just recently discovered tokens in Java and trying to get an understanding of why they are used. I thought tokens were used as break points, but here it almost looks like it is used to limit
private String printResult()
{
StringBuilder result = new StringBuilder();
String swimType=null;
String length=null;
String width=null;
String depth=null;
String volume=null;
String radius=null;
String pnlName = null;
try {
File resultFile = new File("Report.txt");
Scanner resultScanner = new Scanner(resultFile);
while(resultScanner.hasNext())
{
StringTokenizer strToken = new StringTokenizer(resultScanner.nextLine(), ":");
if(strToken.hasMoreTokens())
{
pnlName = strToken.nextToken();
swimType = strToken.nextToken();
if("Box".equalsIgnoreCase(swimType))
{
length = strToken.nextToken();
width = strToken.nextToken();
depth = strToken.nextToken();
volume = strToken.nextToken();
result.append(createResultStr(swimType, length, width, depth, volume));
}
else
{
radius = strToken.nextToken();
depth = strToken.nextToken();
volume = strToken.nextToken();
result.append(createResultStr(swimType, radius, depth, volume));
}
}
}