Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Waits for a object for synchronization purposes.
     */
    public static void wait(Object obj) {
        synchronized (obj) {
            try {
                obj.wait();
            } catch (InterruptedException inex) {
                //ignore
            }
        }
    }

    /**
     * Waits for a object or a timeout for synchronization purposes.
     */
    public static void wait(Object obj, long timeout) {
        synchronized (obj) {
            try {
                obj.wait(timeout);
            } catch (InterruptedException inex) {
                // ignore
            }
        }
    }
}