How many methods in the Serializable interface?
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
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...
In the case of Public, Private and Protected, that is used to describe which programs can access that class or method: public : any other class from any package can instantiate and execute the...
The two common features that are used are: 1. Synchronized keyword – Used to synchronize a method or a block of code. When you synchronize a method, you are in effect synchronizing the code...
Java does not support multiple inheritence directly but it does thru the concept of interfaces. We can make a class implement a number of interfaces if we want to achieve multiple inheritence type of...
1.It separates the working/functional code from the error-handling code by way of try-catch clauses. 2.It allows a clean path for error propagation. If the called method encounters a situation it can’t manage, it can...
Recent Comments