Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Core Java Interview Questions and Answers

Ques 241. How to define an Abstract class?

Ans. A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.
Example of Abstract class:
abstract class testAbstractClass {
protected String myString;
public String getMyString() {
return myString;
}
public abstract string anyAbstractFunction();
}

Is it helpful? Add Comment View Comments
Ques 242. How to define an Interface in Java ?
Ans. 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 243. If a class is located in a package, what do you need to change in the OS environment to be able to use it?

Ans. You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:\dev\com\xyz\hr\Employee.java. In this case, you'd need to add c:\dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:\>java com.xyz.hr.Employee
Is it helpful? Add Comment View Comments
Ques 244. How many methods in the Serializable interface?
Ans. 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 245. How many methods in the Externalizable interface?
Ans. 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

4) How many methods in the Serializable interface? 5) How many methods in the Externalizable interface?
" />

Most helpful rated by users:

©2016 WithoutBook