public static void main(String[] args) {
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            ResponseList<Location> locations;
            locations = twitter.getAvailableTrends();
            System.out.println("Showing available trends");
            for (Location location : locations) {
                System.out.println(location.getName() + " (woeid:" + location.getWoeid() + ")");
            }
            System.out.println("done.");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to get trends: " + te.getMessage());
            System.exit(-1);
        }
    }
public static void main ( String [ ] args ) { try { Twitter twitter = new TwitterFactory ( ) . getInstance ( ) ; ResponseList < Location > locations ; locations = twitter . getAvailableTrends ( ) ; System . out . println ( "Showing available trends" ) ; for ( Location location : locations ) { System . out . println ( location . getName ( ) + " (woeid:" + location . getWoeid ( ) + ")" ) ; } System . out . println ( "done." ) ; System . exit ( 0 ) ; } catch ( TwitterException te ) { te . printStackTrace ( ) ; System . out . println ( "Failed to get trends: " + te . getMessage ( ) ) ; System . exit ( - 1 ) ; } }
Usage: java twitter4j.examples.trends.GetAvailableTrends

@param args message