please tell me when to use getInstance() method in java.

blackberry, jakarta-ee, java

Solution

The following code will give you the latitude and longitude. getInstance() will give back the instance of that particular class.

    Criteria myCriteria = new Criteria();
    myCriteria.setCostAllowed(false);
    LocationProvider myLocationProvider = LocationProvider.getInstance(myCriteria);
    Location myLocation = myLocationProvider.getLocation(300);
    latitude  = myLocation.getQualifiedCoordinates().getLatitude();
    longitude = myLocation.getQualifiedCoordinates().getLongitude();

Problem

When to use the getInstance() method in java and what is the meaning of getInstance(null)? ``` locationProvider = LocationProvider.getInstance(null); ``` can anyone tell me the meaning of the above line?

Original source

Related problems