- 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 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: 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: Why would you use a synchronized block vs. synchronized method?

Answer: Synchronized blocks place locks for shorter periods than synchronized methods. Source:
Question: What modifiers are allowed for methods in an Interface?

Answer: Only public and abstract modifiers are allowed for methods in interfaces. 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 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 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 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: 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 similarities between an Abstract class and Interface?

Answer: Neither Abstract classes or Interface can be instantiated. Source:
Question: What are the differences between Interface and Abstract class?

Answer: Abstract Class Interfaces
An abstract class can provide complete, default code and/or just the details that have to be overridden. An interface cannot provide any code at all,just the signature.
In case of abstract class, a class may extend only one abstract class. A Class may implement several interfaces.
An abstract class can have non-abstract methods. All methods of an Interface are abstract.
An abstract class can have instance variables. An Interface cannot have instance va Source:
Question: What is an exception?

Answer: An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions. Source:
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 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: How does the Java default constructor be provided?

Answer: If a class defined by the code does not have any constructor, compiler will automatically provide one no-parameter-constructor (default-constructor) for the class in the byte code. The access modifier (public/private/etc.) of the default constructor is the same as the class itself. Source:
Question: What is static block?

Answer: Static block which exactly executed exactly once when the class is first loaded into JVM. Before going to the main method the static block will execute. 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:
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:

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.3125 Seconds