JAVA INTERVIEW QUESTIONS
Java Interview Questions for Freshers
When to use java?
If we want to built an application in a free of cost instead of paying then the best programming language is Java.
Where to write this Java?
Java takes the help of editor to build the code. Any editor which supports the java can be used to build the java programs. Some of them are Jbeans, notepad, notepad++, eclipse, etc., Most popularly use editor for java is eclipse.
Why only eclipse they chosen for java?
Its free where directly we can install from net. It has internal interpreter and compiler features. It supports multiple programming languages.
It supports to add additional libraries, APIs which can be used for our programming. It can convert entire code in to 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 Programming language?
Any language which can built the back end and front end, that language is called as Programming language.
ex: Java, .Net, etc.,
What is scripting language?
Any language which can built either front end or back end is called Scripting language
ex: HTML, php, vb scripting, Java scripting, etc.,
What is front end?
The objects/elements which we see in any application is called front end. Even empty spaces can also be considered as a front end in the application.
What is back end?
The background of the screen performing 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 where as Scripting languages may/may not compiled.
The advantage of compiled program is it runs more faster because the code is already converted in to machine code, If any error in the code while compiling then it shows Compile time error.
What is 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 in to machine understandable language there should be one translator which converts any language in to 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 unknown format which is not understandable by the compiler while translating into machine code then we get compile time errors.
Every Programming language have compile time errors but the tools which supports to build that code may have interpreter feature so that it minimize the errors.
What is interpreter?
The code which translates into machine understandable language into line by line is called interpreter. Means it checks the 1st line of code after translating into machine understandable code then it checks into 2nd line of code and translates into machine understandable language. Like this it continues till the end of code.
How to develop this compiler and interpreter?
To develop compiler and interpreter, we use Programming language. We can make a Programming language into scripting language by designing an interpreter
Similarly we can design a compiler for Scripting languages and make it to Programming language
Ex: v8 , which compiles Java Script code into Machine code.
Total How may programming languages are there?
We have more than 250 programming languages
The primary aim for them to develop a language which to supports digital devices
What is Desktop/Standalone application? What technologies will support to build Desktop/Standalone application?
The applications which runs on Desktop is known as Desktop applications ex: Media Player, etc.,
Swing and AWT technologies in Java, supports to build the Desktop/Standalone application.
The application which runs through internet is called web application or the application which runs on server side by creating dynamic pages in client side is called Web application.
Servlet, jsp, Struts, jsf etc., technologies in Java are mainly used for developing web based applications.
What is server?
Server is the centralized location which uses to maintain the application.
What is client?
The users who uses the application is called as Clients.
What is Enterprise applications? Which technology is used to develop Enterprise applications?
The applications which are designed to deal with money and which contains security, those applications are called enterprise applications
EJB in Java is used for designing Enterprise application
What is Mobile application?
Android and Java ME are used for developing Mobile applications.
What is Java Platforms/Editions?
Java have 4 platforms
1. Java SE(Java Standard Edition)
2. Java EE(Java Enterprise Edition)
3. Java ME(Java Micro Editiion)
4. Java FX.
What is Java SE?
Java SE is a programming platform which is use to develop the portable applications for client and server environments.
Java EE is 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 use to develop network applications that deploy across multiple platforms and display in high-performance modern user interface.
Who introduced Java?
Green Team under Sun Micro System initiated Java project in 1991.
The team consist of
They called it as Greentalk with an extension of .gt, later they renamed to OAK and finally to Java in 1995
Why ‘Green Team’ changed 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’. As majority of the people proposed ‘Java’. So ‘Java’ came in the picture.
What are the features of Java?
2. Object Oriented
3. Platform independent
8. High Performance
9. Architecture Neutral
10. Multi Threaded
Why Java is Simple?
Java is simple because it overcome 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 holds values) and the behavior(the logic which we used) which supports Polymorphism and Inheritance where as other languages not. Java useObject Oriented Programming(Oops) concepts of
Why Java is Platform independent ?
Java programs should save with the extension of “.java”. Once it is compiled, the source code is converted in to 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 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, Java program is secured.
Representing diagrammatically as :
Why Java is Robust?
Robust means Strong. Why strong? because it as
1. Srong memory management
2. Automatic garbage collector (means in compile time while storing data in to 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(means it handles all the exceptions which prevents the stoppage of flow)
4. Type checking mechanism(which states weather all are correct as per the java syntax’s)
Why Java is interpreted?
Since interpreter converts line by line code into byte code, while writing Java program itself, java interpreter converts line by line code into machine code. If java interpreter does not understand the code which is not as per Java rules and regulations, then java interpreter shows 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 is no platform dependent features and the size of primitive datatype 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 Java is Portable ?
Java byte code can be executed in any operating system. So, Java is portable.
Why Java is Familiar ?
Now a days Java becoming familiar due to its advantages
Why Java is dynamic?
Java is dynamic because of all the above features.
Java Interview Questions for Fresher
Did Java is Platform – independent?
Can Java used in Windows based, Web – Based, Mobile and Enterprise based applications?
Did Java support “goto” statement as it is in C, C++ language?
Did Java support multiple inheritance through class?
Did Java support multiple inheritance through interface?
Did Java support Operator Overloading?
Is it possible to write Pointer programs in Java?
Did java internally supports pointer?
Did Java have compiler and interpreter feature?
Did Java support call by value?
Did Java support call by reference ?
Did Java supports Structures as in C and C++ ?
Did Java supports Unions as in C and C++ ?
Did Java support Built – in Thread?
Can we use “virtual” keyword in java to override the methods?
Did override is possible in Java?
Can we call non-static methods are virtual by default?
What is super-class of any class ?
Did Java uses single inheritance tree?
Did Java support unsigned right shift (>>>) and unsigned left shift (<<<) operators ?
Did Java support multiple inheritance through class ?
Java interview questions for Freshers
Learn More : Complete Android Programs and Interview Question of Android – Click Here
By Varun Kumar
Any Queries Mail us : firstname.lastname@example.org
Java interview questions for Freshers
Follow Us – Never Miss Update
Please Share – Learn and Share Knowledge