- 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
Java Interview Questions & Answers - Learning Mode

Java Interview Questions & Answers - Learning Mode

Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look and feel" of the C++ language, but it is simpler to use than C++ and enforces an object-oriented programming model.

Try Java Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >> Next

Sort By : Latest First | Oldest First | By Rating

Java Interview Questions & Answers - Learning Mode
Try Java Interview Questions & Answers - Exam Mode
Question: Why do you create interfaces, and when MUST you use one?

Answer: You would create interfaces when you have two or more functionalities talking to each other. Doing it this way help you in creating a protocol between the parties involved. Source:
Question: What is the difference between concat and append?

Question: Why Java is not fully object oriented?

Answer: Java is not a fully object oriented language because it does not support multiple inheritance directly.But it does so by using theconcept of interfaces.

A language is said to be fully object oriented if it supports classes,objects,inheritance and polymorphism.For example C++ supports full fledged feature of inheritance and all the types of inheritances(single,multilevel,multiple,hierarchical and multipath inheritances), and if we take the polymorphism C++ supports static binding and oper Source:
Question: What is package? Define with example?

Answer: A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces. Source:
Question: What is the disadvantage of threads?

Answer: The Main disadvantage of threads is : Threads is operating system dependent. Source:
Question: What is synchronization and why is it important?

Answer: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one
thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors. Source:
Question: How to make application thread-safe ?

Answer: You should use the word synchronized to mark the critical section of code. You may also use other methods of thread synchronization (see wait(), notify(), notifyAll() etc. Source:
Question: Why we can not override static method?

Answer: We can not override final method by definition, but we can override static method.
Question: What is the difference between attribute and parameter ?

Question: Explain working of Java Virtual Machine(JVM).

Answer: JVM is an abstract computing machine like any other real computing machine which interprets the byte code( .class file which contains virtual machine instructions ) to a machine dependent native code. The output of JVM i.e the native code contains low level instructions which is easily understandable by the micro processors which process the native code to give the desire output. Source:
Question: What is the difference between length and length() ?

Question: What restrictions are placed on method overloading?

Answer: Two methods may not have the same name and argument list but different return types. Source:
Question: Are constructors inherited?Can a subclass call the parent's class constructor?When?

Answer: You cannot inherit a constructor. That is, you cannot create a instance of a subclass using a constructor of one of it's superclasses. One of the main reasons is because you
probably don't want to overide the superclasses constructor, which would be possible if they were inherited. By giving the developer the ability to override a superclasses
constructor you would erode the encapsulation abilities of the language. Source:
Question: How will you pass values from HTML page to the Servlet?

Answer: We can pass values to servlet from HTMLpage using "request.getParameter(string);" method.Which is a method in the HttpServletRequest interface.

Submitted by chinnakotla devarathnam ( Source:
Question: Difference: Java Beans, Servlets

Answer: java bean is a reusable component,where as the servlet is the java program which extends the server capability
Question: 1)What are the actual functions of JVM?
2)When to use a class and when to use
an Abstract class?
3)what is the use of constructors other than creation of objects?
4)when to use constructors?
5)when to use Interface?
6)why java does not support pointers?
7)why multiple inheritance is not possible in java without using Interfaces?

Answer: Various function are performed by JVM like garbage collection ,loading class, interpretation of bytecode. Main funtion of JVM is to provide the interfacing between hardware & our JAVA program.It is the platform for execution of JAVA bytecode.
Question: What is difference between & and && in java

Answer: Single Ampercent (& ) can be used as Bitwise operator and Boolean logical operator.

Now the difference arises when & is used as logical operator.

This can be best explained with the help of an example.

int i=5;
if(i<3 & i++ < 10)
//perform action

Now in this case
First expression is i<3
Second expression is i++ < 10

when & is used it will evaluate both the expressions regardless of the fact that it finds first expression as Source:
Question: How System.out.println() works?

Answer: System.out.println();incase System is a class in java.lang package.And out is the static field in the java.lang.System class. It works by a native method. Source:
Question: What is the difference between InputStream/Outputstream classes?

Answer: InputStream and its sub classes are used for reading data in the form of streams.

Ex : FileInputStream, DataInputStream

OutputStream and its sub classes are used for writing data in the form of streams.

Ex: FileOutputStream, DataOutputStream

Submitted by Arun Kumar Pasuparthi ( Source:
Question: How are the elements of a CardLayout organized?

Answer: The elements of a CardLayout are stacked, one on top of the other, like a deck of cards. Source:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >> 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.03125 Seconds