Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TimeThread extends Thread {
- String city;
- String belt;
- public TimeThread(String city, String belt) {
- this.city = city;
- this.belt = belt;
- }
- @Override
- public void run() {
- for (; ; ) {
- String s = Calendar.getInstance(TimeZone.getTimeZone("GMT" + belt)).getTime().toString();
- int i = s.indexOf(":");
- System.out.println(city + ": " + s.substring(i - 2, i + 6));
- try {
- sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement