- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
Core Java Interview Questions & Answers - Learning Mode

Core Java Interview Questions & Answers - Learning Mode

"Core Java" is Sun's term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, et cetera. This is mostly to differentiate from, say, Java ME or Java EE. Also note that they're talking about a set of libraries rather than the programming language. When people talk about core java they usually refer to the features of the java language and the standard libraries alone. Advanced Java is probably everything else you can add, such as Java Enterprise Edition libraries.

Try Core Java Interview Questions & Answers - Exam Mode

1 2 3 4 5 Next

Sort By : Latest First | Oldest First | By Rating

Core Java Interview Questions & Answers - Learning Mode
Try Core Java Interview Questions & Answers - Exam Mode
Question: What do you understand by Synchronization?

Answer: 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 application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption. Source:
Question: What do u mean by "method" in java ?

Answer: Java methods are similar to functions or procedures in other programming languages.

Every Java program must have one main() method.

Here is the main() method from a Java program which prints
"Hello World":

public static void main (String[] args) {
// This Java program prints "Hello World!"
System.out.println{"Hello World!");
Question: Why would you use a synchronized block vs. synchronized method?

Answer: Synchronized blocks place locks for shorter periods than synchronized methods. Source:
Question: What is Encapsulation?

Answer: Encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate. It prevents other objects from directly altering or accessing the properties or methods of the encapsulated object. Source:
Question: How are this() and super() used with constructors?

Answer: * Constructors use this to refer to another constructor in the same class with a different parameter list.
* Constructors use super to invoke the superclass's constructor. If a constructor uses super, it must use it in the first line; otherwise, the compiler will complain.
Question: What does it mean that a method or field is ?static??

Answer: Static variables and methods are instantiated only once per class. In other words they are class variables, not instance variables. If you change the value of a static variable in a particular object, the value of that variable changes for all instances of that class. Static methods can be referenced with the name of the class rather than the name of a particular object of the class (though that works too). That?s how library methods like System.out.println() work. out is a static field in the j Source:
Question: What is the difference between throw and throws?

Answer: Throw:it is used to raise exception explicitly
that means it is use when a user defined exception is raised.

Throws:if a method is capable of throwing an exception but
it does not handle the exception that must be specified by using "throws" class. Source:
Question: What is an abstract class?

Answer: Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation.

* If even a single method is abstract, the whole class must be declared abstract.
* Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
* You can?t mark a class as both abstract and final.
Question: What modifiers are allowed for methods in an Interface?

Answer: Only public and abstract modifiers are allowed for methods in interfaces. Source:
Question: What are the differences between Contructors and Methods?

Answer: Constructors Methods


Create an instance of a class

Group Java statements


Cannot be abstract, final, native, static, or synchronized

Can be abstract, final, native, static, or synchronized

Return Type

No return type, not even void

void or a valid return type


Same name as the class (first letter is capitalized by convention) -- usually a noun

Any nam Source:
Question: Why operator overloading is not there in java?

Answer: C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn?t even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte(). Source:
Question: What is Constructor?

Answer: * A constructor is a special method whose task is to initialize the object of its class.
* It is special because its name is the same as the class name.
* They do not have return types, not even void and therefore they cannot return values.
* They cannot be inherited, though a derived class can call the base class constructor.
* Constructor is invoked whenever an object of its associated class is created.
Question: What are static methods?

Answer: Methods declared with the keyword static as modifier are called static methods or class methods. They are so called because they affect a class as a whole, not a particular instance of the class. Static methods are always invoked without reference to a particular instance of a class.
Note:The use of a static method suffers from the following restrictions:

* A static method can only call other static methods.
* A static method must only access static data.
* A static m Source:
Question: Explain the different forms of Polymorphism.

Answer: Polymorphism exists in three distinct forms in Java:

1.Method overloading
2. Method overriding through inheritance
3. Method overriding through the Java interface
Question: What modifiers are allowed for methods in an Interface?

Answer: Only public and abstract modifiers are allowed for methods in interfaces. Source:
Question: What is method overriding?

Answer: Method overriding occurs when sub class declares a method that has the same type arguments as a method declared by one of its superclass. The key benefit of overriding is the ability to define behavior that?s specific to a particular subclass type.<br>Note:<br><br> The overriding method cannot have a more restrictive access modifier than the method being overridden (Ex: You can?t override a method marked public and make it protected).<br> * You cannot override a method Source:
Question: Explain the Polymorphism principle.

Answer: The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as "one interface, multiple methods". Source:
Question: What are the differences between Class Methods and Instance Methods?

Answer: Class Methods Instance Methods
Class methods are methods which are declared as static. The method can be called without creating an instance of the class Instance methods on the other hand require an instance of the class to exist before they can be called, so an instance of a class needs to be created by using the new keyword.
Instance methods operate on specific instances of classes.
Class methods can only operate on class members and not on instance members as class methods are un Source:
Question: What is similarities between an Abstract class and Interface?

Answer: Neither Abstract classes or Interface can be instantiated. Source:
Question: what is main purpose of abstract class?

Answer: if a class contains abstract method,that class must be declared as a abstract class. Abstract methods contains only declarations. it does not contain objects. Source:

1 2 3 4 5 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.015625 Seconds