Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Core Java Interview Questions and Answers

Test your skills through the online practice test: Core Java Quiz Online Practice Test

Ques 86. How to define an Interface in Java ?

In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Emaple of Interface:

public interface sampleInterface {
	public void functionOne();
	public long CONSTANT_ONE = 1000; 

Is it helpful? Add Comment View Comments

Ques 87. How many methods in the Serializable interface?

There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.

Is it helpful? Add Comment View Comments

Ques 88. How many methods in the Externalizable interface?

There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and writeExternal().

Is it helpful? Add Comment View Comments

Ques 89. What is the difference between Serializalble and Externalizable interface?

When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.

Is it helpful? Add Comment View Comments

Ques 90. Can an Interface have an inner class?

public interface abc{		
	static int i=0; 
	void dd();		
	class a1{			
			int j;
		public static void main(String a1[])
			System.out.println("in interfia");

Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2023 WithoutBook