Ace your java interview pdf


Ace the Programming Interview: Questions and Answers for .. C#. Questions. Java. Questions. The purpose of the Runtime class is to provide access to the Java runtime system . A Java source code file takes the name of a public class or interface that is defined within the How will you pass values from HTML page to the Servlet?. 23) Difference between Character Constant and String Constant in java? 24) What are constants and how to create constants in java?.

Language:English, Spanish, Indonesian
Country:Korea North
Genre:Fiction & Literature
Published (Last):15.09.2016
Distribution:Free* [*Register to download]
Uploaded by: CANDIS

67086 downloads 174958 Views 20.48MB PDF Size Report

Ace Your Java Interview Pdf

First of all, thanks for being a part of I really appreciate little easy to prepare for one interview and use that preparation for next interviews as well. .. also you have to pass time in whiteboard. Well in that case, tell. Java Interview Questions What are the basic interfaces of Java Collections Framework? .. What are pass by reference and pass by value?. Cracking the Coding Interview, Fourth Edition: Programming with almost 15 years' experience using Java He has hosted interviews Java Progra.

Java Module System Is Java a dying language? Java is still one of the most popular programming languages. There are tons of free open source resources available to help you in Java programming. So I am not worried that Java is Dying at all. What is difference between JavaScript and Java? Java code runs in a virtual machine or browser Applets where JavaScript code runs on browser. We have to compile Java source code to byte code before JVM can understand and execute it. We use JavaScript to perform browser specific tasks. We use Java to create standalone utility apps, web applications, and web services.

There are four different types of Access Specifiers in Java — Public — The classes, fields, and methods defined by public access specifier, are accessible by every class. Private — The fields and methods defined by private access specifier are accessible within the same class to which those fields and methods belong. Protected — The fields and methods defined by protected access specifier are accessible only in the class to which those fields and methods belong.

Default — Default means no specifier. When the methods, fields, and classes are not defined by any access specifier, then those methods, fields, and classes are accessible in the package to which those methods, fields, and classes belong. What are the different method signatures in Java?

Answer — A method inside a class is the sequence of statement to perform a specific task. The various elements of the method signature are — Method name — Method name is the mandatory signature, such as display Return type — Return type of the method is also the mandatory method signature, it can be void, int, float, string etc.

Access Modifier — It is the method signature that is not compulsory to be defined. It can be synchronized, static, etc. Access Specifier — Not mandatory method signature; access specifier can be private, public, protected etc.

What do you know about its lifecycle? Answer — A thread is an execution in the program which follows the single flow of control. The life cycle of thread comprises of the five states, that are being mentioned below — Newborn state — When an instance of the thread is created, the thread is considered to be in this newborn state.

In this state, the thread is not considered alive, and the state exists before the start method is invoked. Runnable state — The life of the thread starts from this state i. When the start function is invoked, the thread enters in the runnable state. Running state — When the thread enters the runnable state, it is ready to run and start the program execution.

When the thread is actually in the execution phase, it is said to be in the running state. Blocked state — During the running state, the thread may have to wait for the resources that are being used by any another thread. During the waiting phase, the thread is known to be in the blocked state. Dead state — When the execution of the program is done and the run method is completed, the thread is said to be in the dead state.

After this state, a thread cannot be in execute or run again. What are the Applets? Answer — Applets are the small Java programs that can be sent from one computer to the other computer over the network with the use of Applet Viewer that supports Java. Applets have following properties — Being a Java program, an applet can be run in a web browser It has the set of whole Java API Applets are known to be the fully functional Java application Applets offer a high-level security, called sandbox security Applets follow the security ruled of the web browser Mention the situations when you will prefer to use interfaces and when abstract classes.

Answer — It depends when a Java programmer will use interfaces and when abstract class. Answer — The name of the Java source code file is same as that of the public class or interface, defined by programmer during writing the program code.

100+ Java Interview Questions You Must Prepare In 2019

While naming a Java source code file, there may be occurrence of two different cases — Case 1: When there is no public class or interface in the source code file — Although it is mandatory that source code file will contain only one public class or interface but it may not contain any public class or interface. In this case, the java source code file will be named something else except its interfaces and classes.

Case 2: When there is one public class or interface in the source code file — It is the case when one public class or inheritance occur in the source code file. In this case, the name of the java source code file will be same as that of the public class or interface that has been defined in the program code.

What do you mean by the nested class? Answer — In general, the meaning of nested means one in another. In Java, a nested class means a class within another class i.

Some times, the nested class is also known as the inner class. Answer — Yes, Java supports networking. There are two types of classes in Java to support networking i. These classes control the network applications programming. As Java is platform independent in nature, Java networking is also platform independent. The classes to support Java networking are — Low-level classes — These classes support socket programming like DataramSocket, Socket, and ServerSocket classes.

Is there any alternative to inheritance? Answer — Yes, there is an alternative to inheritance in Java; Delegation. Followings are the important points about delegation — Delegation specifies that there exists an instance of any class that works as the instance variable and used to send messages to that instance of the class.

Due to delegation, the programmer have to write more code. Also, it is harder to reuse the delegation unlike inheritance as it is not a subclass. JDK is the most commonly used software development environment for Java programmers. It is meant for the development of Java applications and applets. It consists of Java Runtime Environment, a compiler javac , an interpreter Java , an archiver jar , a generator for documentation Javadoc , and some other tools that are required in the development of Java applications.

It acts as an interpreter for the byte code. What is encapsulation in Java? Encapsulation is a mechanism where you bind your data variables and code methods together as a single unit.

Here, the data is hidden from the outer world and can be accessed only via current class methods. This helps in protecting the data from any unnecessary modification. We can achieve encapsulation in Java by: Declaring the variables of a class as private.

Providing public setter and getter methods to modify and view the values of the variables. What is an association?

ACE Your Java Interview download .pdf by Jennifer Fu - tinowebse

Association is a relationship where all object have their own lifecycle and there is no owner. Multiple students can associate with a single teacher and a single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. These relationships can be one to one, one to many, many to one and many to many.

What do you mean by aggregation? An aggregation is a specialized form of Association where all object has their own lifecycle but there is ownership and child object can not belong to another parent object. A single teacher can not belong to multiple departments, but if we delete the department teacher object will not destroy.

What is composition in Java? It is a strong type of Aggregation. Child object does not have their lifecycle and if parent object deletes all child object will also be deleted. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different houses if we delete the house room will automatically delete.

What is a marker interface? A Marker interface can be defined as the interface having no data member and member functions. In simpler terms, an empty interface is called the Marker interface.

The most common examples of Marker interface in Java are Serializable, Cloneable etc. The marker interface can be declared as follows. What is object cloning in Java? Object cloning in Java is the process of creating an exact copy of an object.

It basically means the ability to create an object with a similar state as the original object. This method creates a new instance of the class of the current object and then initializes all its fields with the exact same contents of corresponding fields. To object clone , the marker interface java.

Cloneable must be implemented to avoid any runtime exceptions.

Top 100 Java Interview Questions with Detailed Answers

One thing you must note is Object clone is a protected method, thus you need to override it. What is a copy constructor in Java?

Copy constructor is a member function that is used to initialize an object using another object of the same class.

Though there is no need for copy constructor in Java since all objects are passed by reference. Moreover, Java does not even support automatic pass-by-value.

What is a constructor overloading in Java? The compiler uses the number of parameters and their types in the list to differentiate the overloaded constructors. Apart from this Java Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka! Servlets Interview Questions Q1. What is a servlet?

Similar articles

Copyright © 2019 All rights reserved.
DMCA |Contact Us