- 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: 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: 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 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: Why Java is case sensitive?

Answer: Java is multi platform-> Platform Independent Language, so its used widely in very big softwares or games where multiple variables needed. To Differentiate among that huge no of variables,,Java is Case Sensitive. Source:
Question: What is the difference between length and length() ?

Question: What is the difference between concat and append?

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 disadvantage of threads?

Answer: The Main disadvantage of threads is : Threads is operating system dependent. Source:
Question: What is Singleton class?

Answer: Singleton class is a class whose only one object can be created at a time. - To achieve this one method is that we make its constructor private and provide a static method that returns its instance.

When a Singleton class is garbage - collected and then reloaded, a new Singleton instance is created.

Submitted by Amit Mathur.
Question: IBM Interview Questions in Bangalore

Answer: 6.what is single inheritance.

ans:one class is inherited by only other one class
7.what is multiple inheritance.

ans:One class inheriting more than one class at atime

8.can java support multiple inheritance.

9.what is interface.

ans:Interface has only method declarations but no defn
10.what is differenec between abstract class and interface.

ans:In abstract class some methods may contain definition,but in interface every method should 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: Why we can not override static method?

Answer: We can not override final method by definition, but we can override static method.
Question: How many different types of JDBC drivers are present? Discuss them.

Answer: Type 1: JDBC-ODBC Bridge plus ODBC Driver: The first type of JDBC driver is the JDBC-ODBC Bridge. It is a driver that provides JDBC access to databases through
ODBC drivers. The ODBC driver must be configured on the client for the bridge to work. This driver type is commonly used for prototyping or when there is no JDBC driver
available for a particular DBMS.

Type 2: Native-API partly-Java Driver: The Native to API driver converts JDBC commands to DBMS-specific native calls. This is 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: Access specifiers: "public", "protected", "private", nothing?

Answer: Public : Any other class from any package can instantiate and execute the classes and methods.
Protected : Only subclasses and classes inside of the package can access the classes and methods.
Private : The original class is the only class allowed to execute the methods. Source:
Question: What is the difference between instanceof and isInstance?

Answer: instanceof is used to check to see if an object can be cast into a specified type without throwing a cast class exception. isInstance() determines if the specified object is
assignment-compatible with the object represented by this Class. This method is the dynamic equivalent of the Java language instanceof operator. The method returns true
if the specified Object argument is nonnull and can be cast to the reference type represented by this Class object without raising a ClassCastException Source:
Question: Explain Servlet and JSP life cycle

Answer: Servlet Lifecycle:
init() ->this initalizes the servlets initialization information with the configuration parameters.

service : here the business logic starts. that is, all the request and response services goes here.

destroy() : once the process is completed, it will be used to destory all vairables and objects used by servlets.

JSP lifecycle is somewhat diff that servlet life cycle. It includes four steps for the same.
jspInit:works like servlet init m Source:
Question: What are the main differences between
jdk1.4 n jdk1.5?

Answer: Jdk1.4 doesn't contain the tool interface that is JVMTI which is a profiling tool in jdk1.5.The earlier versions of java had JVMPI i.e., profiler interface. 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 Seconds