Showing posts with label thread. Show all posts
Showing posts with label thread. Show all posts

Friday, 24 January 2014

Using isAlive() and join() method in java

 how to use isAlive() and Join( ):

Using isAlive( ) and join( )


As mentioned, often you will want the main thread to finish last.Two ways exist to determine whether a thread has finished.


  •   isAlive()
  • join()

CREATING A THREAD

CREATING AND STARTING THREADS IN JAVA

What are the two different methods of creating a thread in Java? What method must be implemented in either case?


In Java, an object of the Thread class can represent a thread. Thread can be implemented through any one of two ways:

                          1.You can implement the Runnable interface.
                          2.You can extend the Thread class itself.

Creating Multiple Threads in java

how to create multiple thread:multi tasking

Creating Multiple Threads


Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. you have been using only two threads: the main thread and one child thread.

Monday, 20 January 2014

Using finalize() method in java

The finalize() method:


finalize method in java is a special method much like main method in java. finalize() is called before Garbage collector reclaim the Object, its last chance for any object to perform cleanup activity i.e. releasing any system resources held, closing connection if open etc.The intent is for finalize() to release system resources such as open files or open sockets before getting collected.