Category: Javaskool Category
The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected. Note: A class may have only one finalize method and finalizer...
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded...
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored or transmitted and reconstructed later. The Serializable...
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored or transmitted and reconstructed later. The Serializable...
The Serializable interface is just a “marker” interface, with no methods of its own to implement. Other ‘marker’ interfaces are java.rmi.Remote java.util.EventListener
Externalizable is an Interface that extends Serializable Interface. And sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in).
Example that uses java.util.Timer to schedule a task to execute once 3 seconds have passed. ScheduleAndBeep.java import java.util.Timer; import java.util.TimerTask; import java.awt.Toolkit; public class ScheduleAndBeep { Toolkit toolkit; Timer timer; public ReminderBeep(int seconds) {...
FirstThread.java public class FirstThread { public synchronized void startProcess(SecondThread sec) throws Exception { String name = Thread.currentThread().getName(); System.out.println(name + ” Entered FirstThread.startProcess”); Thread.sleep(1000); System.out.println(“Trying to call SecondThread.last”); sec.last(); } public synchronized void last() throws...
abstract keyword is used to create a abstract class and method. Abstract class in java can’t be instantiated. An abstract class is mostly used to provide a base for subclasses to extend and implement...
A class that implement interface must implement all the methods declared in the interface. To implement interface use implements keyword. Since java does not support multiple inheritance in case of class, but by using...
Recent Comments