Core java interview questions with answers, Core Java - Interview Questions and Answers
core,
java, technical, questions, answers,
Hi, Today I would like to share some more Core Java interview Questions.
1. Why the Java not support operator overloading?
Operator
overloading makes the code very difficult to read and maintain. To
maintain code simplicity, Java doesnot support operator overloading.
3. What is Externalizable?
Externalizable
is an Interface that extends the Serializable Interface. And sends data
into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)
4. What modifiers are allowed for the methods in an Interface?
Only public and abstract modifiers are allowed for the methods in interfaces.
5. What is a local, member and class variable?
Variables which are declared within a method are "local" variables.
Variables declared within the class such that not within any methods are "member" variables (global variables).
Variables declared within the class i.e not within any methods and are defined as the "static" are class variables.
Variables declared within the class such that not within any methods are "member" variables (global variables).
Variables declared within the class i.e not within any methods and are defined as the "static" are class variables.
6. What is abstract method?
An abstract method is a method whose implementation is deferred to subclass.
7. What value does read() return when it has reached end of a file?
The read() method returns -1 when it reaches the end of a file.
8. Can a Byte object be cast to the double value?
No,
9. What is difference between a static and a non-static inner class?
A
non-static inner class may have object instances that are associated
with the instances of class's outer class. A static inner class does not
have any object instances.
10. What is an object's lock and which object's have the locks?
An
object's lock is a mechanism that is used by the multiple threads to obtain
synchronized access to the object. A thread may execute a synchronized
method of an object only after it has acquired the object's lock. All
objects and classes have locks. A class's lock is acquired on the
class's Class object.
11. What is % operator?
It
is referred to as the modulo or remainder operator. It returns the
remainder of dividing first operand by second operand.
12. When can an object reference be cast to an interface reference?
An object reference be cast to an interface reference when object implements the referenced interface
ConversionConversion EmoticonEmoticon