Java Programming Interview Questions
Java Technical Interview Questions: Learn Java collections interview questions for all technical jobs HR round java interview questions with answers
When to use java?
If we want to build an application free of cost instead of paying then the best programming language is Java.
Where to write this Java?
Java takes the help of an editor to build the code. Any editor which supports java can be used to build java programs. Some of them are Jbeans, notepad, notepad++, eclipse, etc., Most popularly use editor for java is an eclipse.
Why was only eclipse chosen for java?
It’s free where directly we can install it from the net. It has internal interpreter and compiler features. It supports multiple programming languages.
It supports adding additional libraries and APIs which can be used for our programming. It can convert entire code into Jar files. etc.,
There are plenty of programming language which covers the front end and back end such as Java, .Net, etc.,
What is language? How many types of languages are there?
Basically, there are 2 types of languages
1. Programming language
2. Scripting language
What is a Programming language?
Any language which can build the back end and front end, that language is called a Programming language.
ex: Java, .Net, etc.,
What is a scripting language?
Any language which can be built on either the front end or back end is called Scripting language
ex: HTML, PHP, vb scripting, Java scripting, etc.,
What is the front end?
The objects/elements which we see in any application are called the front end. Even empty spaces can also be considered as a front end in the application.
What is the back end?
The background of the screen performing the entire operation can be called as Back end.
When to use Scripting languages and when to use Programming languages?
When we need to build only UI or logic then we use scripting languages and to build both UI and logic then we use Programming languages.
Programming languages must be compiled whereas Scripting languages may/may not be compiled.
The advantage of the compiled program is it runs faster because the code is already converted into machine code, If there is any error in the code while compiling then it shows Compile time error.
What is a compiler? Why it came in to picture?
The computer can only understand binary language ie., in 0s and 1s. To translate the general human readable language into machine understandable language there should be one translator which converts any language into machine readable language.
This compiler is one which translates the entire code at once into machine code. And while translating the entire code into machine code if it finds an unknown format which is not understandable by the compiler while translating into machine code then we get compile time errors.
Every Programming language has to compile time errors but the tools which support building that code may have an interpreter feature so that it minimizes the errors.
What is an interpreter?
The code which translates into machine-understandable language line by line is called an interpreter. This means it checks the 1st line of code after translating it into machine-understandable code then it checks into 2nd line of code and translates it into machine-understandable language. Like this, it continues till the end of the code.
How do develop this compiler and interpreter?
To develop a compiler and interpreter, we use Programming language. We can make a Programming language into a scripting language by designing an interpreter
Similarly, we can design a compiler for Scripting languages and make it into a Programming language
Ex: v8, which compiles Java Script code into Machine code.
Total How many programming languages are there?
We have more than 250 programming languages
The primary aim for them is to develop a language which too supports digital devices
What is a Desktop/ Standalone application? What technologies will support building off a Desktop/ Standalone application?
The applications which run on the Desktop are known as Desktop applications ex: Media Player, etc.,
Swing and AWT technologies in Java support to build of the Desktop/Standalone application
The application which runs through the internet is called a web application or the application which runs on the server side by creating dynamic pages on the client side is called a Web application.
Servlet, JSP, Struts, JSF etc., technologies in Java are mainly used for developing web-based applications.
What is the server?
The server is the centralized location which uses to maintain the application.
What is the client?
The users who use the application are called Clients.
What are Enterprise applications? Which technology is used to develop Enterprise applications?
The applications which are designed to deal with money and which contain security, those applications are called enterprise applications
EJB in Java is used for designing Enterprise application
What is the Mobile application?
The application that is supported for mobile devices is called the mobile application.
Android and Java ME are used for developing Mobile applications.
Java have 4 platforms
1. Java SE(Java Standard Edition)
2. Java EE(Java Enterprise Edition)
3. Java ME(Java Micro Edition)
4. Java FX.
What is Java SE?
Java SE is a programming platform which is used to develop portable applications for client and server environments.
Java EE is an enterprise platform which uses to develop web and enterprise applications.
What is Java ME?
Java ME is a micro platform which uses for embedded systems such as mobiles and set-top boxes.
What is Java FX?
Java FX is used to develop network applications that deploy across multiple platforms and display in the high-performance modern user interface.
The team consist of
They called it as Green talk with an extension of .gt, later they renamed it to OAK and finally to Java in 1995
Why did ‘Green Team’ change OAK to JAVA?
Actually OAK is the symbol of Strength but it was the trademark of ‘OAK Technologies’. Since ‘OAK’ is registered under Trademark, the team thought of a word which relevant ‘revolutionary’, ‘dynamic’, ‘lovely’, ‘cool’, ‘unique’, ‘fun’. A majority of the people proposed ‘Java’. So ‘Java’ came into the picture.
What are the features of Java?
2. Object Oriented
3. Platform independent
8. High Performance
9. Architecture Neutral
Why Java is Simple?
Java is simple because it overcomes the drawbacks of c++ i.e., Java doesn’t contain Pointers (means a variable which holds the address of memory location.), Operator Overloading (priority of operators under in logic) and introduced automatic Garbage Collector (which removes unused code from the memory after the program execution).
Why Java is Object Oriented?
Object-oriented means the combination of data(generally variables which hold values) and the behaviour (the logic which we used) which supports Polymorphism and Inheritance whereas other languages do not. Java useObject Oriented Programming(Oops) concepts of
Why Java is the Platform independent?
Java programs should save with the extension of “.java”. Once it is compiled, the source code is converted into Byte code with the extension of “.class” by the compiler. As this “.class” file contains 0s and 1s, which is common in all the operating system(Since all the Operating Systems(UNIX, LINUX, WINDOWS, MAC and etc..) understands 0s and 1s). So Java is platform independent. It uses WORA(Write Once Run Anywhere).
Why Java is Secured?
Java is secured because no explicit Pointer(which gives the address of memory location) and the Java program runs inside JVM(Java Virtual Machine) and this JVM runs inside JRE(Java Runtime Environment) and this JRE runs inside JDK(Java Development Kit). As the java program is covered by JVM, JRE and JDK, the Java program is secured.
Representing diagrammatically as :
Why Java is Robust?
Robust means Strong. Why strong? because it as
1. Strong memory management
2. Automatic garbage collector (means in compile time while storing data into respective memory location, this garbage collector collects all the unused data from the program and cleans it. So that there is no storage of memory for unused data in the memory location)
3. There is exception handling(which means it handles all the exceptions which prevent the stoppage of flow)
4. Type checking mechanism(which states whether all are correct as per the java syntaxes)
Why Java is interpreted?
Since the interpreter converts line-by-line code into byte code, while writing the Java program itself, the java interpreter converts line-by-line code into machine code. If the java interpreter does not understand the code which is not as per Java rules and regulations, then the java interpreter shows a red ‘x’ mark at that line which may cause due to syntax error or invalid datatype or unknown data etc., It also gives suggestions by mouse over on it.
———-> For unknown data
——> giving suggestions when mouse over on ‘x’ mark
—> For invalid datatype
—-> giving suggestion for invalid datatype when mouse over on ‘x’ mark
Why Java is high performance?
Java is high performance since already source code is converted to byte code during compiling, it executes faster.
Why Java is Architecture Neutral?
Java compiler generates an architecture-object(Byte code) file format which makes compile code to be executed in any operating system with the help of JRE. There are no platform-dependent features and the size of primitive data is fixed in all environment
Ex: For int datatype, it occupies 4 bytes of memory for 32 and 64-bit architecture. So, Java is Architecture Neutral.
Why Java is Multi-Threaded?
Each program is executed by a single thread. But we can write a Java program which deals with many tasks at once by defining multiple threads.
The main advantage of Multi-Threading is it shares the same memory.
It is used mostly in Multi-media applications and web applications.
Why Java is Distributed?
We can create distributed applications using Java. EJB and RMI are used for creating distributed applications. So Java is distributed.
Why is Java Portable?
Java byte code can be executed in any operating system. So, Java is portable.
Why Java is Familiar?
Nowadays Java becoming familiar due to its advantages
Why Java is dynamic?
Java is dynamic because of all the above features.
Java Technical interview questions
Q) Did Java is Platform – independent?
Q) Can Java be used in Windows-based, Web – Based, Mobile and Enterprise based applications?
Q) Did Java support the “goto” statement as it is in C and C++ languages?
Q) Did Java support multiple inheritances through class?
Q) Did Java support multiple inheritances through the interface?
Q) Did Java support Operator Overloading?
Q) Is it possible to write Pointer programs in Java?
Q) Did java internally support the pointer?
Q) Did Java have compiler and interpreter features?
Q) Did Java support call by value?
Q) Did Java support call by reference?
Q) Did Java supports Structures as in C and C++?
Q) Did Java supports Unions as in C and C++?
Q) Did Java support Built-in Thread?
Q) Can we use the “virtual” keyword in java to override the methods?
Answer: No, we don’t have the “virtual” keyword in Java to override the methods
Q) Did override is possible in Java?
Answer: Yes, for non-static methods
Q) Can we call non-static methods virtual by default?
Q) What is a super-class of any class?
Answer: Ye, java. lang.Object
Q) Did Java uses a single inheritance tree?
Q) Did Java support unsigned right shift (>>>) and unsigned left shift (<<<) operators?
Java interview questions for Fresher’s experience
Learn More: Part II- Java collections Interview Questions
Java collections interview questions list, java interview questions, java interview questions and answers, core java interview questions, java programming questions, java programming interview questions, java interview programs, java questions and answers, java basic interview questions, advanced java interview questions, java developer interview questions, java coding interview questions, java collections interview questions, java programming interview questions and answers, simple java programs for interview, core java programming interview questions, java technical interview questions, Java collections interview questions online free, list of Java collections interview questions, best Java collections interview questions, technical Java collections interview questions for freshers, Java collections interview questions for experienced, MNC jobs Java collections interview questions careers, important Java collections interview questions experienced, pdf download of Java collections interview questions freshers expedience, fresher and experienced Java collections interview questions download, beginner Java Technical Interview Questions, senior Java Technical Interview Questions, fresher Java Technical Interview Questions