Eric Duval

Greenhorn
+ Follow
since Sep 12, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric Duval

Oh, also you never need to import the java.lang.*; as far as I know... Such as:

import java.lang.String.*;


And you should consider just doing:

import java.util.*;

But that's just my opinion
13 years ago
import java.util.TreeMap;
public class TreeMapTest {

public static void main (String args[]) {
TreeMap<String, Integer> theMap = new TreeMap<String, Integer>();

theMap.put("NY", 1);
theMap.put("CA", 1);


String state = "CA";
if(theMap.containsKey(state)) {
int count = theMap.get(state) + 1;
theMap.put(state, count);
}

System.out.println("California was found " + theMap.get("CA") + " times.");
System.out.println("Here is the full map:\n " + theMap.toString());
}
}

===============
OUTPUT:
===============

California was found 2 times.
Here is the full map:
{CA=2, NY=1}
13 years ago
You need to use the trim method of String, not the trim method of AppUtil, which does not exist.

So:

return lastName.trim() + ", " firstName.trim() + " " + middleName.trim() + " " + suffix.trim();
13 years ago