SHIVPRASAD KOIRALA JAVA EBOOK

adminComment(0)

Shivprasad Koirala. Mumbai India; Sep 19 ; C# SQL Server Java. Design Patterns & Practices (50%) · wfhm.info (33%) · Architecture (16%). Others (1%). Java j2ee job interview companion ebook. Vijay Ekkaladevi. Pocket java. Kumaran K. 25 best hibernate interview questions and answers. questions java interview questions software testing interview questions koirala shivprasad koirala pdf dot net interview questions by.


Shivprasad Koirala Java Ebook

Author:MITCH DELISA
Language:English, Japanese, German
Country:Sri Lanka
Genre:Environment
Pages:370
Published (Last):19.01.2016
ISBN:788-7-72590-524-5
ePub File Size:24.67 MB
PDF File Size:18.38 MB
Distribution:Free* [*Registration needed]
Downloads:29565
Uploaded by: JOSEPHINA

About the Author: Shivprasad Koirala is an IT professional with the experience of handling software projects in the banking, finance and travel sectors. Currently. I also need this latest edition so this is my email skpanigrahi gmail. NET Interview questions - SQL Server Interview questions - Java. Get free access to PDF Ebook Shivprasad wfhm.info Interview Free download java interview questions and answers by shivprasad koirala.

Thanks for such nice videos and pdf. I am very happy I was able to find your site and sign up for it. I am starting with ASP. It's easy, direct and very useful.

Thank you. Sheo Narayan for last couple of days and I really believe this book deserves some review. The book starts with the basics of ASP. NET and other tricks which every developer must know while writing code. Basically the Book is all about code. It gives you insight on all the How To's that you would ever search over search engine when writing your code. NET Projects Questpond's Video series road map for freshers As a fresher when you see videos spanning across 60 sections you wonder "Where to start from?

So, to know more click here. Learn step by step with us Why choose questpond when you have so many choices? Our training videos are not just theory based but they are practical , step by step , project based and to the point. You would hardly find any power point presentations in our videos. Watch our sample videos to understand our quality. We have more than videos Look at our syllabus and humanly its impossible for any developer to watch all videos. So we have weekly one hour live trainings which ensures that developers gets kick started.

These trainings are conducted on saturday during evening times. We do not just provide videos and leave the developers to struggle. If they have issues we have email support and if needed skype support. So when a new object is created of the same class it will have completely its own copy of instance variables. While Static values have only one copy of instance variables and will be shared among all the objects of the class. We will be explaining the above two classes in the coming sections.

It does nothing special but creates four objects and increments the static and non-static properties. In the below figure at the left hand side you can see the static variables values are preserved as they are. Inner classes are nested inside other class. They have access to outer class fields and methods even if the fields of outer class are defined as private.

Packages group related classes and interfaces together and thus avoiding any name conflicts. Class1 ; objp1Class1.

Below is the solution of the package project. You can see that we can have class with same name but they lie in different packages. Normally in big projects where we have huge amount of classes its better to group them logically together so that can be manageable.

Constructor has the same name as the class in which it resides and looks from syntax point of view it looks similiar to a method. Constructor is automatically called immediately after the object is created, before the new operator completes. Constructors have no return type, not even void. This is because the implicit return type of a class' constructor is the class type itself.

It is the constructor's job to initialize the internal state of an object. Below is a snippet of constructor code: Yes we can have parameterized constructor which can also be termed as constructor overloading. I Explain in depth Garbage collector? Garbage collection is the process of automatically freeing objects that are no longer referenced by the program.

This frees the programmer from having to keep track of when to free allocated memory, thereby preventing many potential bugs. Thus making programmers more productive as they can now put more effort in coding rather than worrying about memory management. The only disadvantage of garbage collector is it adds overheads. Because the JVM Java virtual machine has to keep a constant track of the objects which are not referenced and then free these unreferenced objects on fly. This whole process has a slight impact on the application performance.

But garbage collector has a good algorithm and it runs in its. Lets try to understand root and reach from the below code snippet. In the above snippet we have two roots one is the class root i. Sometimes the object needs to perform some action before the object is destroyed. For instance if an object is holding some non-Java resource such as a file handle which you might want to make sure are released before the object is destroyed.

For such conditions Java provides a mechanism called finalization. By using finalization, you can define specific actions that will occur when an object is just about to be reclaimed by the garbage collector.

JVM calls that method whenever it is about to recycle an object of that class. GC runs periodically checking for objects that are no longer referenced. That is, the switch looks only for a match between the value of the expression and one of its case constants. When Java compiler compiles a switch statement it looks at the case constants and creates a jump table that it will use for selecting the path of execution depending on the value of the expression.

So if you are comparing large group of values switch will be faster than sequence of if-elses. Compiler knows that the case constants are all the same type and simply must be compared for equality with the switch expression. The compiler has no such knowledge of a long list of if expressions.

In the below code snippet we are displaying the number in words. This is a useful option when the original source code is not available. Applets are small applications that are accessed from web server automatically installed, and run from the browser.

Once an applet arrives on the client it has limited access to resources thus ensuring security for the end user.

Download Shivprasad Koirala Questpond Sample JAVAJ2EE Interview Quest pdf

An applet is controlled by the software that runs it. Usually, the underlying software is a browser, but it can also be applet viewer. If you run the applet source code from eclipse it runs inside an applet viewer. All applets should inherit from applet class. Below are sequences of events which occur in applet: The init method is called when the applet is first loaded.

Init method can be used to initialize color, fonts or any type of one type operation needed for the applet. The start Method: The start method is called when user visits a browser with an applet on it.

In start method applet spawns a thread in which it runs the paint method. Applet must always redraw its output when paint method is called. To just add something about this object it actually contains the graphics context.

Graphic context determines the graphics environment in which the applet will be running and applet will use the same context to display output on the browser. The stop and destroy Methods: The stop method stops the applet user goes to a different web page.

The destroy method is called when the browser exits. This is the place we can put in cleaning up of threads or any resource which is not a java resource. In order to make your fundamental stronger there is a small program on applet which displays my name of the book.

JAVA was designed thinking platform independency in mind. So from loading libraries point of view it should not rely only on only file systems. So JAVA went one step further you can load classes from. In order to attain this Class loaders came in to picture. Class loader is the class responsible for finding and loading classes at runtime. You can either use different class loaders or you can make a custom one.

There three types of class loaders: Bootstrap Class loader Bootstrap class loader loads those classes those which are essential for JVM to function properly. Bootstrap class loader is responsible for loading all core java classes for instance java. Extension Class loader The extension class loader also termed as the standard extensions class loader is a child of the bootstrap class loader.

This provides the ability to simply drop in new extensions, such as various security extensions, without requiring modification to the user's class path. Ok below is a simple class lets get in to details of how the class will be loaded.

Import Koirala. But before he tries to load it will delegate to extension class loader. Extension class loader will pass it to Boot strap class loader. Now Boot Strap class loader does not have any parent so it will try to load. Now the Boot strap will return the class back using the same chain to the application. For the import statement JVM will make a call to the system class loader who will delegate the same to the extension class loader which will delegate the same to the boot strap class loader.

Extension class loader will also check the same in its path and will not find anything thus returning nothing to the system class loader. System class loader will use its class path and load the class and return the same to the JVM who will then return it to the application.

In the above code snippet we also have marked the steps in order. In short we need to know from the start what type of object we will be creating. While in dynamic class loading we need to know the string name of the class and then everything else will be dynamically loaded. Reflection API is a member of core java. The methods provided by the Reflection API obtain information about a class, such as the fields, constructors, methods, and super classes of the class.

In addition, you can obtain the interfaces implemented by the class. You can notice in the above sample how we inspected the methods in the class. There are six interfaces and come under two different inheritance group one which comes under the collection interface root and the other in the map interface root. It provides a unified way to manipulate collection objects. Collection has group of object called as elements. These elements can be accessed and manipulated using Iterator. List In List interface the elements are arranged sequentially.

Elements can be inserted in to any location and you can also insert duplicate elements. Map Map stores association between keys and value pairs. So given a key you can easily find the value. One thing important to note is they do not implement iterable interface.

But yes you can obtain a collection view of the map which allows you loop using for loop. I Can you explain in brief the collection classes which implement the collection interfaces?

ArrayList support dynamic arrays that can grow depending on demand. But traditional JAVA arrays are of fixed length once they are created. ArrayList are designed so that they can grow depending on demand. But there is a cost attached to the same. The cost of allocating and reallocating memory. You can prevent. Below is the syntax: As this is an interview question book I have not got in to sample code for arraylist. It provides link-list data structure. Below is the code snippet which shows LinkedList class in action.

We can add elements to the beginning or the end of the list using the below code snippet: In order to get the first and the last element of the linked list we can use the getFirst and getLast methods respectively. Below is the code snippet for the same: HashSet extends AbstractSet and implements the Set interface. It creates a collection that uses a hash table for storage. Hash table stores information by using a mechanism called hashing. Information of the key is used to determine a unique value termed hash code.

This hash code is then used as an index for data associated with the key is stored. This happens automatically and you will never need to know the hash code value. Also, your code can't directly index the hash table. The biggest advantage of hashing is that execution time of add , contains , remove , and size to remain same even when the collection are large in size. Hash set does not guarantee sorting.

tion books in market with same name.

You can see from the below code snippet that data is not sorted. LinkedHashSet extends HashSet class but it does not add any extra members as such. LinkedHashSet maintains list of entries in the order in which they are inserted. So when you iterate through a LinkedHashSet class elements will be returned in the order they are inserted.

TreeSet creates a collection that uses a tree for storage. Items in collection are stored in ascending order. TreeSet are good choice for storing large amount of data. By default JAVA sorts collection in ascending order. We can use the Comparator Interface to specify a sort order. Comparator interface provides compare method which compares two elements.

Below is the syntax snippet for the same: It sorts using the string length. In order to achieve this we have created two classes clsComparator and clsMain.

We can see object of clsComparator is passed to the TreeSet object. You can access the elements using Iterator or ListIterator. For sample you can look at the above comparator sample which uses iterator to display the details. You can also use for- each to loop. Given a key, you can find its value. Keys and values are stored as objects. Keys always have to be unique but the values may be duplicated. Some maps can accept null key and null values. Maps don't implement the Iterable interface.

So that means you cannot iterate through a map using a for-each. But collection-view of a map allows getting around the sort coming of iteration.

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

Sorted Map ensures that the entries are maintained in ascending order based on the keys. You can also use the comparator specify some custom sort order. But for the sake of just grabbing some in your mind I have listed all. Just see which you have used and say the same during interview.

Returns true if the elements were added and false otherwise. Returns the position of value in list, or a negative value if value is not found. The list must be sorted. An attempt to insert an incompatible element will cause a ClassCastException.

Returns true if the two collections contain no common elements i. Otherwise, returns true. See "The Enumeration Interface," later in this chapter. Returns the index of the first match, or — 1 if no match is found.

Returns the index of the last match, or — 1 if no match is found. The collection need not be sorted. Returns true if at least one replacement occurred. Returns false, otherwise. That is, the returned comparator reverses the outcome of a comparison that uses comp. To rotate left, use a negative value for n.

This is an easy way to convert a single object into a set. This is an easy way to convert a single object into a list. Before the collection framework JAVA provided ad hoc classes such as Dictionary, Vector, Stack and Properties to store and manipulate group of objects.

Following are the main reason why collection framework is more desirable than the traditional JAVA collection objects: One of the unifying themes in the new JAVA collection is the iterator interface. It gives a unifying way for looping through JAVA collections. Algorithms operate on collections and are defined as static methods within the Collections class. Thus, they are available for all collections. Each collection class need not implement its own versions.

The algorithms provide a standard means of manipulating collections. In case of traditional JAVA collection you will need to code all these implementation by yourself. Given a key and value, you can store the value in a Dictionary object. Once the value is stored, you can retrieve it by using its key. Thus, like a map, a dictionary can be. Although not currently deprecated, Dictionary is classified as obsolete, because it is fully replaced by Map.

When using a Hashtable, you specify an object that is used as a key, and the value that you want linked to that key. The key is then hashed, and the resulting hash code is used as the index at which the value is stored within the table.

You can visual HashMap as replacement for Hashtable. Properties Properties is a child class of Hashtable. It is specially used to maintain lists of values in which the key and the value is String.

The Properties class is used by many Java classes. For instance type of object returned by System. One of the most useful aspects of Properties is that the information contained in a Properties object can be easily stored to or loaded from disk with the store and load methods.

At any time, you can write a Properties object to a stream or read it back. Vector Vector implements a dynamic array. Though similar to ArrayList it has one main differences Vector is synchronized. Which mean any thread using Vector is thread safe. Enumeration interface defines the methods by which you can enumerate the elements in a collection of objects.

Cost of thread safe is performance degradation. So if you are sure that you are not dealing with huge. When we create a string object that means you are creating a string which can not be changed.

So once you have created a string object you can not change the value of string. You must be thinking but I can always change the value. Yes but when you assign a value it creates a new object and the first object is still in memory. Lets try to understand the same by the below code snippet. In the above code we have assigned the string with two values. So there are two objects of string instances created in the above statement. First statement declares the string object at this point no object is created.

As soon as you assign a value to the str a object is created and assigned to it. But the first instance is still in memory. StringBuffer is a peer class of String that provides almost all functionality of strings.

String represents fixed-length, immutable character sequences. Comparatively StringBuffer represents mutable, growable and writeable character sequences.

Below is a simple code which shows clearly the efficiency of StringBuffer object. When we loop using String class we are creating 10 objects. But with StringBuffer only one object is created. It is very much similar to StringBuffer except for one difference: The advantage of StringBuilder is good performance. In case of multithreading, you must use StringBuffer rather than StringBuilder.

The function or the method can not change variable values. In pass By ref the function or subroutine receives a pointer of the variable. And any changes to variable value are also visible outside the function or subroutine. Lets try to understand the concept from the below snippet code. Even when we have changed the object reference it still reflects the old object value.

In short object references are passed by value. Access modifiers decide whether a method or a data variable can be accessed by another method in another class or subclass. Java provides four types of access modifiers: Private - Can be accessed only within the class. Even methods in subclasses in the same package do not have access.

Default - Its private access by default accessible to classes in the same package but not by classes in other packages, even if these are subclasses. Assertion includes a Boolean expression. If the Boolean expression evaluates to false AssertionError is thrown.

Assertion helps a programmer to debug the code effectively. Assertion code is removed when the program is deployed. Below is a code snippet which checks if inventory object is null. Many times in project you need to create exact copy of the object and operate on them. To do this there two ways of doing it Shallow clone and Deep clone. When an object is Shallow cloned the parent object or the top level object and its members are duplicated.

But any lower level objects are not duplicated. Rather references of these objects are copied. So when an object is shallow cloned and you modify any of it child classes it will affect the original copy.

When an object is deep cloned the entire object and its aggregated objects are also duplicated. Below is the diagram which explains things in a clear and pictorial manner.

In the above diagram there are three blocks the first block is the original object, second block is the Shallow clone and the third is Deep clone block. Here the object to be cloned is a simple Customer class which has multiple addresses.

Now when you shallow clone it you can see the top class clsCustomer is duplicated but clsAddresses still refers to the. But in case of Deep clone complete new copy is created of the whole structure.

In order to implement shallow cloning we need to implement cloneable interface and override the clone method with implementation. You can look in to the below code snippet.

In the above code snippet we have defined a class clsExampleClone which implements the Cloneable interface. We have also provided implementation for the clone method. It just returns the parents clone object.

Once we have defined this object we created the. All objects implement a clone method Every object is responsible for cloning itself via its clone method. So when the parent is called it makes calls to all the referenced objects inside the class and calls its clone method. Serialization This is the best way to deep cloning and not to mention best answer in interview of how to implement deep cloning. There are three steps to do deep cloning using serialization: Below is the code snippet which implements all the above steps.

In the above code snippet note the three important steps which have been marked for simplicity. Define a complex object and try to create a deep cloned object from the function. That means only one instance of the object need to be running. It makes sense that no object of the class need to be created. Below are some important points to be noted for final modifiers: They play the same role as constant variables.

But you can change the object data. Static initializer block is a method with no name sounds funny hmm , no arguments, and no return type. It doesn't need a name, because there is no need to refer to it from outside the class definition.

The code in a static initializer block is executed by the JVM when the class is loaded. You can use the static initializer block to initialize static variables or do some class level initialization. Static initializer block runs only once irrespective of how many instances you create of the object.

Above is the code snippet which shows how static initializers work. The first thing which will execute is the static initializer block and then the void main method. One of the important point to keep in mind is it runs before the constructor. Feel free to test it using constructor. You can have more than one static initializer block in your class definition, and they can be separated by other code such as method definitions and constructors.

The static initializer blocks will be executed in the order in which they appear in the source code. Changing the type of the value from one type to other is termed as casting.

For instance look at the below code snippet in which we are trying to cast integer value to double data type. To explicitly cast an expression prefix the expression with type name as shown in the code snippet below. For instance in the below code snippet my inventory object is type casted and stored as type Object. When you try to move a big value data type to a small data type variable it leads to narrowing conversion.

Below is the code snippet which explains in detail of how the conversion happens. In the below code we are trying to move double to an integer data type. Because integer data type is smaller than double data type it looses its decimal portion. Widening conversion is exactly vice versa of the same in which try to move small data type value to big one.

In this case no conversion happens and neither have we loosed. Below is the conversion tree which says when Widening conversion will happen and when narrowing conversion will be done. So if we try to move up the tree that means if we try move char to int, int to long, float to double widening conversion will happen. If we try to move down the tree like int to char, double to int narrowing conversion will happen and probably also data loss.

You might also like: EBOOK BUDIDAYA IKAN CUPANG

We need to specify explicit casting only if narrowing conversion is taking place. Doing that we say to the compiler that we are aware of the data loss which can happen.

Let us first try to understand the question in a more precise manner. Glance the below class diagram which depicts a typical hierarchical relation ship between two wheelers.

So can we move an object of Cycle to object of two wheeler?. Answer is yes we can do it by type casting the parent to child type. Again the law of conversion hierarchy applies here. In the below figure you can see the two arrows one which points from top to down and the other vice-versa. So if you are moving from down the hierarchy to the top you do not need to do explicit casting. That means if you move cycle object to two wheeler compiler will not throw error.

But if you try to move two wheeler to cycle it will throw an error if you have not defined explicit casting of the object type.

Below is the sample pseudo code which shows how things work. Basically there are four important keywords which form the main pillars of exception handling: Code which you want to monitor for exception is contained in the try block. If any exception occurs in the try block its sent to the catch block which can handle this error in a more rational manner. To throw an exception manually you need to call use the throw keyword.

If you want to put any clean up code use the finally block. The finally block is executed irrespective if there is an error or not. Below is a small error code snippet which describes how the flow of error goes. Arithmetic exception will flow from try block to the arithmetic catch block and then execute the finally block. But the general exception will flow from the try block, then to the exception.

In short the finally block always execute. All exception types are subclasses of Throwable. Throwable is at the top of the exception class hierarchy. Immediately below Throwable are two subclasses that partition exceptions into two distinct branches. One branch is headed by Exception.

This class is used for exceptional conditions that user programs should catch. This is also the class that you will subclass to create your own custom exception types.

There is an important subclass of Exception, called RuntimeException. Exceptions of this type are automatically defined for the programs that you write and include things such as division by zero and invalid array indexing. Exceptions of type Error are used by the Java run-time system to indicate errors having to do with the run-time environment, itself. Stack overflow is an example of such an error.

Exceptions generated from runtime are called unchecked exceptions, since it is not possible for the compiler to determine that your code will handle the exception. Exception classes that descend from RuntimeException and Error classes are unchecked exceptions.

Examples for RuntimeException are illegal cast operation, inappropriate use of a null pointer, referencing an out of bounds array element. Error exception classes signal critical problems that typically cannot be handled by your application.

Examples are out of memory error, stack overflow, failure of the Java VM. Thrown exceptions are referred to as checked exceptions. The compiler will confirm at compile time that the method includes code that might throw an exception.

Moreover the compiler requires the code that calls such a method to include this call within a try block, and provide an appropriate catch block to catch the exception. Below are some unchecked exceptions: Below are some checked exceptions: Just define a subclass of Exception and then you can override methods to provide custom functions. The chained exception feature allows you to associate another exception with an exception.

This second exception describes the cause of the first exception. Consider a situation in which you are getting null exception because of permission issues. You would like to know if this exception is associated with some other exception. For chained exceptions there are two constructors and two methods. The constructors are shown here: That is, causeExc is the underlying reason that an exception occurred.A transaction is proper if it fulfils ACID properties.

Interviewer also expects them to have people management skills. Example color is abstracted to RGB. The collection need not be sorted. In object oriented world objects have relation and hierarchies in between them. If you can read English, you can read this book That means for every request a new object will not be created.

Vipul Raut. Read Locks A read lock is a lock placed on a resource that is being read or accessed by a transaction.

FRANCINE from Waterbury
See my other posts. I'm keen on urban exploration. I do like studying docunments almost .
>