Before going for any interview for the selection on any post related to Java, then you must have to get some idea about interview questions. That is, how interviewers ask questions in interview hall. So to crack Java interview, you must have go through the most important and frequently asked Java interview questions.
This can also helps you to feel better in Java Interview (Java Practical Examination Hall). Here we listed only those Java questions, that can be frequently asked in the Java interview or Java practical examination.
The programming approach that focuses on the procedures for the solution of a problem is known as procedural programming paradigm. This approach emphasizes on the 'doing' rather than the 'data'.
In modular programming, a set of related procedures with the data they manipulate is combined under a until called module. Where there is no grouping of procedures with related data, the procedural programming approach still applies.
An object is an identifiable entity with some characteristics and behaviour. It represents an entity that can store data and its associated functions.
Abstraction is the act of representing essential features without including the background details. And encapsulation is the way of combining both data and the functions that operate on the data under a single unit.
A derived class is a class that inherits properties by some other class. And a base class is a class whose properties are inherited by derived class.
A derived class has nearly all the properties of base class but the reverse of it is not true.
It is the ability for a message or data to be processed in more than one form. It is a property by which the several different objects respond in a different way (depending upon its class) to the same message. more detail
Inheritance is the capability of one class of things to inherit the capabilities or properties from another class.
The property of decomposing a system into a set of cohesive and loosely coupled modules.
Like any other programming language, we can use Java to write or create various types of computer applications. The word platform generally used to refer to some combination of hardware and system software. The Java platform is a new software platform designed to deliver and run highly interactive, dynamic and secure applications on networked computer systems.
In ordinary compilation, the source code is converted to a machine code, which is dependent upon the machine or the platform. This resultant machine code is called native executable code. Contrary to ordinary compilers, the Java compiler does not produce native executable code for a particular machine. Instead it produces a special format called byte code. The Java byte code looks a lot like machine language, but unlike machine language Java byte code is exactly the same on every platform.
JVM stands for Java Virtual Machine. The Java Virtual Machine is an abstract machine designed to be implemented on the top of existing processors. It hides the underlying operating system from Java applications. Program written in Java are compiled into Java Byte code, which is then interpreted by a special Java Interpreter for a specific platform. Actually this Java interpreter is known as the Java Virtual Machine (JVM).
The Java programs need to be written just once, which can be run on different platforms without making changes in the Java program. Only the Java interpreter is changed depending upon the platform. This characteristic is known as Write Once Run Anywhere.
The bytecode. Java is compiled in byte code which is the intermediate language between the source code and the machine code. This byte code isn't platform specific and hence can be fed to any platform. This gives Java 'write once and run anywhere' nature.
A Java program can contain many classes. But one class in a Java program can contain the main method. This class is called initial class.
All Java applications begin their execution from main method. If no main method is there in a Java program, then no execution takes place.
The two types of Java application are Internet applets and Stand alone applications.
Internet applets can't run on their own. They run from within a web browser whereas Java stand alone applications can run independently on any platform.
A machine instruction for a Java processor chip called Java Java Virtual Machine (JVM).
Java Application Programming Interface. Libraries of compiled code that can be used in Java programs.
Keyword is a word carrying special meaning and purpose. And Identifiers are user defined names for different parts of program.
Literals are data items that never change their value during a program run. more detail
A variable is a named memory location, which holds a data value of a particular data types.
Implicit type conversion is performed by Java compiler wherein smaller data types are promoted into higher data types. And explicit type conversion is performed by the programmer using (type) operator, this process is also known as type casting.
Explicit conversion of an operand to a specific type. more detail
A break statement terminates the current loop and proceeds to the first statement that follows that loop.
A labelled break statement terminates the current loop and proceeds to the first statement that follows that loop that is labelled by the identifier that follows the keyword break.
A loop that never ends.
There are many advantages of using functions in programs, but the major advantages are:
In Call by Value, the called function creates its own work copy for the passed parameters and copies the passed values in it. Any changes that take place remain in the work copy and the original data remains intact.
In Call by Reference, the called function receives the reference to the passed parameters and through this reference, it accesses the original data. Any changes that take place are reflected in the original data.
One major characteristic of OOP is its close correspondence with the real-world entities. Like real-world entities, OOP objects also are created and scrapped. When an object is created, it must be constructed with some logical initial value automatically without being specified by the programmer. In this job of initializing an object, some legal value is carried out by the constructor of the class, the object belongs to. Therefore, the constructor takes over this very important duty of initialization of an object being create and relieves us from this task.
The member functions of every object have access to a sort of magic keyword named this, which points to the object itself. Thus any member function can find out the address of the object of which it is a member. The this keyword represents an object that invokes a member function. It stores the address of the object that is invoking a member function and it (this keyword) is an implicit argument to the member function being invoked.
The this keyword is useful in returning the object (address) of which the function is a member.
In a program, if a function calls itself (whether directly or indirectly), is known as recursion.
In iteration, the code is executed repeatedly using the same memory space. That is, the memory space allocated once, is used for each pass of the loop. On the other hand, in recursion, since it involves function call at each step, fresh memory is allocated for each recursive call. For this reason, i.e., because a function call overheads, the recursion function runs slower than its iterative counterpart.
Actual parameters also called as arguments. The variables or values passed to a function. And Formal parameters also called as parameters. The variables that receive the incoming values in a function.
System.in and System.out refer to input stream and output stream respectively, managed by System class.
Exception in general refers to some contradictory or unusual situation which can be encountered while executing a program.
The exception handling is ideal for :
A catch block is a group of Java statements that are used to handle a raised exception.
Advantages of exception handling are :
An arrays is a collection of variables of the same type that are referenced by common name.
A bunch of bytes stored on some storage device.
In text files, data are stored as per a specific character encoding scheme e.g., ASCII text or Unicode text is stored.
In binary files, data are stored in the form of bytes that are in machine readable form.
A stack is a linear structure implemented in LIFO (Last In First Out) manner where insertions and deletions take place only at one end i.e., the stack's top.
An insertion in a stack is called pushing and a deleting from a stack is called popping.
When a stack, implemented as an array, is full and no new element can be accommodated, it is called an OVERFLOW.
When a stack is empty and an element is tried to delete from the stack, it is called an UNDERFLOW.
A queue is a linear structure implemented in FIFO (First In First Out) manner where insertions can occur only at the "rear" end and deletions can occur only at the "front" end.
Circular Queues are the queues implemented in circle form rather than a straight line.