i am trying a develop a application..following is a snippet
class metro_nodes {
public String station;
public GeoPoint point; }
public class mainscreen extends MapActivity {
/** Called when the activity is first created. */
MapController controller;
double latitude,longitude;
LocationManager loc;
Location lastknownloc;
LocationListener loclistener;
List<GeoPoint> geopoints = new ArrayList<GeoPoint>();
MapView mapView;
private LinkedList<metro_nodes> station_location = new LinkedList<metro_nodes>();
metro_nodes anand_nagar;
anand_nagar.station = "anand_nagar";
}
now in the second last line its giving -“Syntax error on token “station”, VariableDeclaratorId expected after this token”
if i put curly braces around this statement then error get removed..but then i get java lang null pointer exception…
whats the problm ??
You haven’t posted the code that gives you the syntax error…but I’m guessing you’re getting the null pointer exception because you never initialized any “metro_nodes” objects.
For example: