JAVA Test TimeZone Methods from the Java Class Library For
JAVA
Test TimeZone Methods from the Java Class Library
. For this problem, submit a Java Project named TimeZoneYourLastName.
Choose five methods from the TimeZone class in the Java Class Library and test them.
Suggestion: before doing anything else run this code in a main method:
This will give you a list of IDs to choose from for creating TimeZone objects.
Also: don\'t use a constructor to create a new TimeZone object. Use the static method getTimeZone.
Solution
package timezone;
import java.util.Locale;
 import java.util.TimeZone;
public class TimeZoneYourLastName {
   public static void main(String[] args) {
 //
 //       for(String s : TimeZone.getAvailableIDs( )) {
 //       System.out.println(s);
 //       }
        System.out.println(TimeZone.getTimeZone(\"Africa/Abidjan\").toZoneId());
         System.out.println(TimeZone.getTimeZone(\"Turkey\").getDisplayName());
         System.out.println(TimeZone.getTimeZone(\"Turkey\").getRawOffset());
         System.out.println(TimeZone.getDefault().getID());
        System.out.println(TimeZone.getTimeZone(\"Turkey\").getDSTSavings());
         Locale locale = new Locale(\"CHINESE\", \"CHINA\");
        System.out.println(TimeZone.getTimeZone(\"Africa/Abidjan\").getDisplayName(locale));
  //       }
    }
}
Output:
Africa/Abidjan
 Eastern European Time
 7200000
 Asia/Calcutta
 3600000
 Greenwich Mean Time

