90% assurance of interview questions
There is the list of 300 core java interview questions. If there is any core java interview question that has been asked to you, kindly
post it in the ask question section. We assure that you will get here the 90% frequently asked interview questions and answers.
The answers to the core java interview questions are short and to the point. The core java interview questions are categorized in
Basics of java interview questions, OOPs interview questions, String Handling interview questions, Multithreading interview
questions, collection interview questions, JDBC interview questions, etc.
1 2 3 4 5
Core Java: Basics of Java Interview Questions
1) What is Java?
Summer Internship 2019
A Beginner's Guide To Learning Python. Start Creating Your
Own Scripts with 100% Job 6000+
crawsecurity.com OPEN
Java is the high-level, object-oriented, robust, secure programming language, platform-independent, high performance,
Multithreaded, and portable programming language. It was developed by James Gosling in June 1991. It can also be known as the
platform as it provides its own JRE and API.
2) What are the differences between C++ and Java?
The differences between C++ and Java are given in the following table.
,Comparison C++ Java
Index
Platform- C++ is platform-dependent. Java is platform-independent.
independent
Mainly used for C++ is mainly used for system Java is mainly used for application programming. It is widely
programming. used in window, web-based, enterprise and mobile applications.
Design Goal C++ was designed for systems and Java was designed and created as an interpreter for printing
applications programming. It was an systems but later extended as a support network computing. It
extension of C programming language. was designed with a goal of being easy to use and accessible
to a broader audience.
Goto C++ supports the goto statement. Java doesn't support the goto statement.
Multiple C++ supports multiple inheritance. Java doesn't support multiple inheritance through class. It can
inheritance be achieved by interfaces in java.
Operator C++ supports operator overloading. Java doesn't support operator overloading.
Overloading
Pointers C++ supports pointers. You can write Java supports pointer internally. However, you can't write the
pointer program in C++. pointer program in java. It means java has restricted pointer
support in java.
Compiler and C++ uses compiler only. C++ is Java uses compiler and interpreter both. Java source code is
Interpreter compiled and run using the compiler converted into bytecode at compilation time. The interpreter
which converts source code into executes this bytecode at runtime and produces output. Java is
machine code so, C++ is platform interpreted that is why it is platform independent.
dependent.
Call by Value and C++ supports both call by value and Java supports call by value only. There is no call by reference in
Call by reference call by reference. java.
Structure and C++ supports structures and unions. Java doesn't support structures and unions.
Union
Thread Support C++ doesn't have built-in support for Java has built-in thread support.
threads. It relies on third-party libraries
for thread support.
Documentation C++ doesn't support documentation Java supports documentation comment (/** ... */) to create
comment comment. documentation for java source code.
, Virtual Keyword C++ supports virtual keyword so that Java has no virtual keyword. We can override all non-static
we can decide whether or not override methods by default. In other words, non-static methods are
a function. virtual by default.
unsigned right shift C++ doesn't support >>> operator. Java supports unsigned right shift >>> operator that fills zero at
>>> the top for the negative numbers. For positive numbers, it
works same like >> operator.
Inheritance Tree C++ creates a new inheritance tree Java uses a single inheritance tree always because all classes
always. are the child of Object class in java. The object class is the root
of the inheritance tree in java.
Hardware C++ is nearer to hardware. Java is not so interactive with hardware.
Object-oriented C++ is an object-oriented language. Java is also an object-oriented language. However, everything
However, in C language, single root (except fundamental types) is an object in Java. It is a single
hierarchy is not possible. root hierarchy as everything gets derived from java.lang.Object.
3) List the features of Java Programming language.
There are the following features in Java Programming Language.
Simple: Java is easy to learn. The syntax of Java is based on C++ which makes easier to write the program in it.
Object-Oriented: Java follows the object-oriented paradigm which allows us to maintain our code as the combination of
different type of objects that incorporates both data and behavior.
Portable: Java supports read-once-write-anywhere approach. We can execute the Java program on every machine. Java
program (.java) is converted to bytecode (.class) which can be easily run on every machine.
Platform Independent: Java is a platform independent programming language. It is different from other programming
languages like C and C++ which needs a platform to be executed. Java comes with its platform on which its code is
executed. Java doesn't depend upon the operating system to be executed.
Secured: Java is secured because it doesn't use explicit pointers. Java also provides the concept of ByteCode and
Exception handling which makes it more secured.
Robust: Java is a strong programming language as it uses strong memory management. The concepts like Automatic
garbage collection, Exception handling, etc. make it more robust.
Architecture Neutral: Java is architectural neutral as it is not dependent on the architecture. In C, the size of data types may
vary according to the architecture (32 bit or 64 bit) which doesn't exist in Java.
Interpreted: Java uses the Just-in-time (JIT) interpreter along with the compiler for the program execution.
, High Performance: Java is faster than other traditional interpreted programming languages because Java bytecode is
"close" to native code. It is still a little bit slower than a compiled language (e.g., C++).
Multithreaded: We can write Java programs that deal with many tasks at once by defining multiple threads. The main
advantage of multi-threading is that it doesn't occupy memory for each thread. It shares a common memory area. Threads
are important for multi-media, Web applications, etc.
Distributed: Java is distributed because it facilitates users to create distributed applications in Java. RMI and EJB are used
for creating distributed applications. This feature of Java makes us able to access files by calling the methods from any
machine on the internet.
Dynamic: Java is a dynamic language. It supports dynamic loading of classes. It means classes are loaded on demand. It
also supports functions from its native languages, i.e., C and C++.
4) What do you understand by Java virtual machine?
Java Virtual Machine is a virtual machine that enables the computer to run the Java program. JVM acts like a run-time engine
which calls the main method present in the Java code. JVM is the specification which must be implemented in the computer
system. The Java code is compiled by JVM to be a Bytecode which is machine independent and close to the native code.
MikroCaps
Microencapsulation solutions
MikroCaps actively and creatively design
superior products based on innovations.
mikrocaps.com
OPEN
5) What is the difference between JDK, JRE, and JVM?
JVM
JVM is an acronym for Java Virtual Machine; it is an abstract machine which provides the runtime environment in which Java
bytecode can be executed. It is a specification which specifies the working of Java Virtual Machine. Its implementation has been
provided by Oracle and other companies. Its implementation is known as JRE.
JVMs are available for many hardware and software platforms (so JVM is platform dependent). It is a runtime instance which is
created when we run the Java class. There are three notions of the JVM: specification, implementation, and instance.
JRE