Free Offer

Stunning Videos Ever

Apple Future Concept Phones

Concorde Last Flight

Nasa Concept of Personal Aircraft

Electromagnetic Airplane Launch

Glass Technology Stunning Concept

B1,B2,B-52 Carpet Bombing

Funniest Moments in Cricket History

ET3 - The Transportation Future

Tomahawk Cruise Missle

China Future Aircraft Concept

Japan Earthquake and Tsunami

F-14 Sonic Boom

Cars of the Future

Future of Tyre Design

Funny French Rocket Launcher

737 Crash Landing

Unexpected Penalty Goal

Microsoft Concept of 2019

Most Beautiful Goals in Football History

13 Plants Those could Kill you

When we talk about threats from living creatures to human life then things those come in mind are Cobra, Crocodile, Shark, Black Mamba etc. We never think about certain plants like this. Following is the list of 13 fruit/simple plants whose poison can ultimately cause human death.

An apple a day might keep the doctor away, but the same can't be said for apple seeds. The seeds contain cyanogenic glycosides, and if you consume enough of the seeds, you could ingest a fatal dose. If you cut up apples for your children or prefer to eat whole apples down to the core, make sure you remove those seeds. (Johnny Appleseed never seemed so villainous!)

Oleander is one of the most toxic, commonly grown garden plants in the world — and oddly enough, it's often found in schoolyards. Ingesting any part of this plant can be deadly, especially for children. Even smoke from burning oleander can be fatal. In fact, according to the Toxic Exposure Surveillance System (TESS), there were 847 known human poisonings in the United States related to oleander in 2002.

Rosary pea
This plant may sound pious, but it's actually deadly. Rosary peas got their name from their traditional use as ornamental beads for rosaries. They are used in jewelry around the world. Many jewelry makers have died after pricking a finger while handling a rosary pea. The poison contained within the seed is abrin — a close relative of ricin and one of the most fatal toxins on Earth.

White snakeroot
White snakeroot contains the toxin tremetol, which can be poisonous if consumed directly or second-hand. When snakeroot is consumed by cattle, the animals' beef and milk become contaminated with the toxin, and ingesting those substances can lead to a condition called milk sickness. Abraham Lincoln's mother, Nancy Hanks, reportedly died after swallowing snakeroot-contaminated milk. Human disease is uncommon today because of current practices of animal husbandry and the pooling of milk from many producers, but milk sickness does still occur.

Monkshood has a long tradition as a deadly plant and was used by ancient warriors to poison the water of their enemies. It was once used as a popular werewolf-detection tool. The flower was held near the alleged wolf’s chin, and if a yellow-tinged shadow appeared, that was confirmation that the person was a werewolf.

Angel's trumpet
Angel's trumpets are woody-stemmed bushes with pendulous flowers that hang like bells. They are prized as decorative additions to the garden because of their elegant flowers. The catch is that all parts of these plants contain dangerous levels of poison and may be fatal if ingested by humans or animals. Angel's trumpets have occasionally been used to create a recreation drug, but the risk of overdose is so high that these uses often have deadly consequences.

Castor beans
If you have consumed castor oil before, you might be surprised to learn that castor beans contain one of the most poisonous substances in the world, ricin. Just one castor bean has enough ricin to kill an adult within a few minutes. Despite this grim quality, castor bean plants are frequently grown for decorative purposes.

Doll's Eye
It's a good thing the creepy-looking berries of this plant aren't enticing, because consuming the fruit of a doll's eye plant (or white baneberry) could kill you. The berries contain cardiogenic toxins that can have an immediate sedative effect on cardiac muscle tissue. Ingestion of the berries can lead to cardiac arrest and death.

This is one of the most famous poisonous plants in history — it's the flora responsible for killing Socrates. All parts of the plant contain the relatively simple alkaloid coniine which causes stomach pains, vomiting and progressive paralysis of the central nervous system. Hemlock is also known by several common names, including devil's porridge, beaver poison or poison parsley.

Stinging tree
Found in forests in Queensland in Australia and Indonesia, Dendrocnide moroides is the deadliest and most potent stinging nettle in the world. Accidentally brushing past any part of this plant can deliver a potent toxin that will cause a painful stinging sensation lasting for days or even months. A severe sting from this plant has been known to kill humans, and it is certainly deadly to pigs, horses, dogs and most other animals.

Deadly nightshade
The name says it all — both the foliage and the berries of this plant are extremely toxic. Deadly nightshade has a long, colorful history of use as a poison, but what many people don't realize is that the nightshade family includes common food plants, including potatoes, tomatoes, eggplants and chili peppers. In fact, all of these plants contain toxins — usually in their foliage — that can be harmful. In particular, humans and pets should avoid potato and tomato foliage and vines in the garden.

European yew
Relatively common in Europe, northwest Africa and the Middle East, nearly all parts of this slow-growing tree can be poisonous. The exception is the red fleshy aril that surrounds the toxic seeds. The aril is frequently eaten by birds. Some people have chosen to commit suicide by ingesting the leaves or the seeds, both of which contain a poison called taxanes.

Prized for their beauty, daffodils grow from bulbs that could be mistaken for an edible food, like an onion. Daffodils — also known by their Latin name Narcissus — are common ornamental plants with a bright, cheery and mostly toxin-free flower. Most daffodils are deer- and vermin-resistant, but gardeners shouldn't overlook the dark side of this plant. The Greek philosopher Socrates sometimes referred to daffodils as the "Chaplet of the infernal Gods" because of the plant's numbing effect.

Above information is taken from

Best Search Page Ever

Set me as your Home Page Forever Please.
Enter something to search and then press the search button of your choice

Upcoming Movies,Technology,Games HD Videos Never Seen Before

Upcoming Movies,Technology,Games HD Videos Never Seen Before

If you want unique videos regarding Hollywood upcoming movies, new technology advancements, Famous Personalitites, upcoming Xbox and Video games then there is one good website for you i.e.

Please do visit it and share with your friends.

Microsoft Smart Move of Buying Nokia Business Could Have Great Impact on Smart Phone Industry

Though Microsoft put its foot very late into smart phone industry but now they are picking up pace to come into competition with Apple and Google. One step forward to this is the investment in Nokia Business.

The Finnish company's outgoing CEO Stephen Elop and interim CEO Risto Siilasmaa said Tuesday that The decision to sell Nokia's devices and services division to Microsoft for $7.2 billion was a difficult choice, but it was must to really shape things up because we were lacking behind as compared to our competitors.

The deal, if it passes regulatory approvals, will profoundly change the mobile market, transforming Microsoft into more of an Apple-like company with integrated hardware and software. It's the same move that Google made by acquiring Motorola Mobility, too.

Now only time will tell how Microsoft move its card after taking ownership of Nokia. Microsoft has habit of being slow in making decisions but this time they need to be spot on because Apple and Google are already moving swiftly as far as smart phone market is concerned.

Solve Apache issue "SSLProtocolException: handshake alert: unrecognized_name" OR enableSNIExtension=false

How to Solve  unrecognized_name SSLProtocolException

You normally get this error with JDK 7 and its because of enableSNIExtension added to the JDK. It normally occurs when server doesn't present browser with the domain name which is registered in the certificate (Name set to the CN value). To solve this issue the solution is very simple. You need to set the server name in you application server. A simple example for Apache configuration is shown below:

NameVirtualHost *:443
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin email address here
    DocumentRoot /srv/www/
    ErrorLog /srv/www/
    CustomLog /srv/www/ combined

<VirtualHost *:443>
    DocumentRoot /srv/www/

    ErrorLog /srv/www/
    CustomLog /srv/www/ combined

    SSLEngine on
    SSLOptions +StrictRequire
    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key
"Unrecognized_name" SSLProtocolException will occur only if above yellow marked
properties will not be set in your apache configuration. Moreover the name given 
for these properties must match the CN value in certificate. 
Also if specific domain name is set for VirtualHost  instead of "*" then this name 
should also match the CN set in certificate and those set in above yellow marked properties.

Super Fast Bullet Train in USA

Super Fast Bullet Trains in USA

Yes, its true. Now USA people will also enjoy the fastest bullet train ride in the near future to stand with world in the race of bullet trains. The reason for this is fact that now the planners are finally beginning to make headway on what could become the largest, most complicated infrastructure project ever attempted in the US. The Obama administration got on board with an $10 billion infusion, and more cash is likely en route from Congress. It’s enough for Florida and Texas to dust off some previously abandoned plans and for urban clusters in the Northeast and Midwest to pursue some long-overdue upgrades. The nation’s test bed will almost certainly be California, which already has voter-approved funding and planning under way. But getting up to speed requires more than just seed money. For trains to beat planes and automobiles, the hardware needs to really fly. Officials are pushing to deploy state-of-the-art rail rockets. Next stop: the future.

Java/J2ee Interview Questions

Java Interview Questions

Below are some of the Java Questions those you should know before appearing for interview.

What is the difference between an Interface and an Abstract class?

An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

What is the purpose of garbage collection in Java, and when is it used?

The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used

Describe synchronization in respect to multithreading?

With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.

What are pass by reference and passby value?

Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.

What is HashMap and Map?

Map is Interface and Hashmap is class that implements that.

Difference between HashMap and HashTable?

The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.

Difference between Vector and ArrayList?

Vector is synchronized whereas arraylist is not.

Difference between Swing and Awt?

AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.

State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers?

public : Public class is visible in other packages, field is visible everywhere (class must be public too)
private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature.
protected : Is available to all classes in the same package and also available to all subclasses of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature.
default :What you get by default ie, without any access modifier (ie, public private or protected).It means that it is visible to all within a particular package

What is an abstract class?

Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie, you may not call its constructor), abstract class may contain static data. Any class with an abstract method is automatically abstract itself, and must be declared as such.
A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.

What is static in java?

Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.

What is final?

A final class can't be extended ie., final class may not be subclassed. A final method can't be overridden when its class is inherited. You can't change value of a final variable (is a constant).

Can I have multiple main methods in the same class?

No the program fails to compile. The compiler says that the main method is already defined in the class.

What is Overriding?

When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass.
When the method is invoked for an object of the class, it is the new definition of the method that is called, and not the method definition from superclass. Methods may be overridden to be more public, not more private.

What are different types of inner classes?

Nested top-level classesMember classes, Local classes, Anonymous classes
Nested top-level classes- If you declare a class within a class and specify the static modifier, the compiler treats the class just like any other top-level class.
Any class outside the declaring class accesses the nested class with the declaring class name acting similarly to a package. eg, outer.inner. Top-level inner classes implicitly have access only to static variables.There can also be inner interfaces. All of these are of the nested top-level variety.

Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables. This means a public member class acts similarly to a nested top-level class. The primary difference between member classes and nested top-level classes is that member classes have access to the specific instance of the enclosing class.

Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration. In order for the class to be useful beyond the declaration block, it would need to implement a
more publicly available interface.Because local classes are not members, the modifiers public, protected, private, and static are not usable.

Anonymous classes - Anonymous inner classes extend local inner classes one level further. As anonymous classes have no name, you cannot provide a constructor.

What is serialization?

Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream.

What is the common usage of serialization?

Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of an object is to be saved, objects need to be serilazed.

What are Native methods in Java?

Java applications can call code written in C, C++, or assembler. This is sometimes done for performance and sometimes to access the underlying host operating system or GUI API using the JNI.

The steps for doing that are:

  • First write the Java code and compile it
  • Then create a C header file
  • Create C stubs file
  • Write the C code
  • Create shared code library (or DLL)
  • Run application
 What are class loaders?

The class loader describes the behavior of converting a named class into the bits responsible for implementing that class.

Class loaders eradicate the JREs need to know anything about files and file systems when running Java programs.

A class loader creates a flat name space of class bodies that are referenced by a string name and are written as:

Class r = loadClass(String className, boolean resolveIt);

What is Reflection API in Java?

The Reflection API allows Java code to examine classes and objects at run time. The new reflection classes allow you to call another class's methods dynamically at run time. With the reflection classes, you can also examine an instance's fields and change the fields' contents.

The Reflection API consists of the java.lang.Class class and the java.lang.reflect classes: Field, Method, Constructor, Array, and Modifier.

Explain the difference between static and dynamic class loading.

The static class loading is done through the new operator.

Dynamic class loading is achieved through Run time type identification. Also called as reflection

This is done with the help of the following methods:

getClass(); getName(); getDeclaredFields();
Instance can also be created using forName() method. It loads the class into the current class memory.

Explain Shallow and deep cloning.

Cloning of objects can be very useful if you use the prototype pattern or if you want to store an internal copy of an object inside an aggregation class for example.

Deep cloning - You clone the object and their constituent parts.

It should be used when it is inappropriate to separate the parts; the object is formed of, from it.

Shallow cloning - You clone only the object, not their parts. You add references to their parts.

It should be used when it is adequate to have the references added to the cloned object

What is the purpose of Comparator Interface?

Comparators can be used to control the order of certain data structures and collection of objects too.

The interface can be found in java.util.Comparator

A Comparator must define a compare function which takes two Objects and returns a -1, 0, or 1

Sorting can be done implicitly by using data structures of by implementing sort methods explicitly.

Explain the impact of private constructor.

Private Constructors can't be access from any derived classes neither from another class.

So you have to provide a public function that calls the private constructor if the object has not been initialized, or you have to return an instance to the object, if it was initialized.

This can be useful for objects that can't be instantiated.

 What are static Initializers?

A static initializer block resembles a method with no name, no arguments, and no return type. There is no need to refer to it from outside the class definition.






The code in a static initializer block is executed by the virtual machine when the class is loaded.

Because it is executed automatically when the class is loaded, parameters don't make any sense, so a static initializer block doesn't have an argument list.

Define the purpose of Externalizable Interface.

The Externizable interface extends the serializable interface.

When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject()two methods to control more complex object serailization process.

When you use Externalizable interface, you have a complete control over your class's serialization process. The two methods to be implemented are :

void readExternal(ObjectInput)

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

void writeExternal(ObjectOutput)

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

What are transient and volatile modifiers?

When serializable interface is declared, the compiler knows that the object has to be handled so as so be able to serialize it. However, if you declare a variable in an object as transient, then it doesn’t get serialized.

Specifying a variable as volatile tells the JVM that any threads using that variable are not allowed to cache that value at all.

Volatile modifier tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program.

What are daemon threads?

Threads that work in the background to support the runtime environment are called daemon threads.
Eg garbage collector threads.

When the only remaining threads in a process are daemon threads, the interpreter exits. This makes sense because when only daemon threads remain, there is no other thread for which a daemon thread can provide a service.

You cannot create a daemon method but you can use
public final void setDaemon(boolean isDaemon) method to turn it into one.

What is JAVAdoc utility?

Javadoc utility enables you to keep the code and the documentation in sync easily.

The javadoc utility lets you put your comments right next to your code, inside your ".java" source files.

All you need to do after completing your code is to run the Javadoc utility to create your HTML documentation automatically.

Explain the difference between StringBuilder and StringBuffer class.

StringBuilder is unsynchronized whereas StringBuffer is synchronized. So when the application needs to be run only in a single thread then it is better to use StringBuilder.

StringBuilder is more efficient than StringBuffer.

Explain semaphore and monitors in java threading.

A semaphore is a flag variable used to check whether a resource is currently being used by another thread or process.

The drawback of semaphores is that there is no control or guarantee of proper usage.

A Monitor defines a lock and condition variables for managing concurrent access to shared data. The monitor uses the lock to ensure that only a single thread is active in the monitor code at any time.

A semaphore is a generalization of a monitor. A monitor allows only one thread to lock an object at once.

Describe synchronization in respect to multithreading.

Multithreading occurs asynchronously, meaning one thread executes independently of the other threads. In this way, threads don’t depend on each other’s execution. In contrast, processes that run synchronously depend on each other. That is, one process waits until the other process terminates before it can execute

What are Checked and UnChecked Exception?

The java.lang.Throwable class has two subclasses Error and Exception. There are two types of exceptions non runtime exceptions and runtime exceptions. Non runtime exceptions are called checked exceptions and the unchecked exceptions are runtime exceptions.

Runtime Exceptions occur when the code is not robust and non runtime exceptions occur due to the problems is environment, settings, etc.

What are different types of inner classes?

Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration

Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables.

Anonymous classes - Anonymous classes have no name, you cannot even provide a constructor.

What is serializable Interface?

If we want to transfer data over a network then it needs to be serialized. Objects cannot be transferred as they are. Hence, we need to declare that a class implements serializable so that a compiler knows that the data needs to be serialized.

How does thread synchronization occurs inside a monitor?

A Monitor defines a lock and condition variables for managing concurrent access to shared data. The monitor uses the lock to ensure that only a single thread is active in the monitor code at any time. A monitor allows only one thread to lock an object at once.

What is the difference between AWT and Swing?

Classes in swing are not OS dependent. They don’t create peer components, so they are light weight unlike AWT.

They don’t take the look and feel of the target platform so they have a consistent appearance

What is meant by Stream Tokenizer?

The StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time. The parsing process is controlled by a table and a number of flags that can be set to various states. The stream tokenizer can recognize identifiers, numbers, quoted strings, and various comment styles.

What is resource bundle?

The place where an application stores its locale-specific data (isolated from source code).

When your program needs a locale-specific resource your program can load it from the resource bundle that is appropriate for the current user's locale.

What is a thread? What are the advantages we derived by programming with thread?

Threads allow programs to execute simultaneously. A thread is an independent path of execution in a program. These threads can be executed synchronously or asynchronously. All threads have a priority attached. Thread with a higher priority is executed first.

•        Allows multiple programs to be executed concurrently
•        Cost of thread is low compared to processes in terms of space and communication.
•        Threads are lightweight.

Explain how to create a thread and start it running.

Creating a thread:
Declare a class as a sub class of Thread
Class SampleThread extends Thread
          Long minSample; {
          SampleThread( Long minSample);
          Public void run()
          Program goes here
Run the thread: An instance is created to start the thread.
SampleThread s = new SampleThread(100);

What is multithreaded program? What is the importance of thread synchronization?

A multithreaded program involves multiple threads of control in a single program. Each thread has its own stack. Other resources of the process are shared by all threads and while trying to access them it should be synchronized.

Importance of thread synchronization:
Avoids issues like deadlocks and starvation
Can be used for de bugging multi threaded programs

What is the difference between yielding and sleeping?

Sleep holds the threads execution for the specified time. On the other hand, yield will cause the thread to rejoin the queue. When a task is invoked in yielding, it returns to the ready state. While when a task is invoked in sleeping, it returns to the waiting state.

What is the difference between C++ & Java?

•        Java does not support Enums, Structures or Unions but supports classes.
•        Java does not support multiple inheritance or operator overloading
•        Java allows functions to be overloaded
•        In java, memory leaks are prevented by automatic garbage collection
•        C++ allows direct calls to be made to the native system libraries. On the other hand java calls these libraries trough java native interface.
•        In c++ parameters are passed by either value or pointers. In java, due to the absence of pointers, parameters are passed by value.

What is JAR file?

JAR is a Java Archived file which allows many files to be stored. All applets and classes can be stored in a JAR file thereby reducing the size. JAR files can be created using the JAR command that comes with JDK. This JAR file can also be digitally signed. In this case, the JAR file itself is not signed. But, all the files inside it are signed.

What is JNI?

Java Native Interface is a framework that allows the Java code running in the Java Virtual Machine to interact and communicate with other applications and libraries written in some other languages. JNI is typically used when an application cannot be entirely written in Java. JNI can be invoked only by signed applets and applications.

What is serialization?

Serialization is an operation in which an object’s internal state is converted into a stream of bytes. This stream is then written to the disk. This stream can also be sent over a socket. Serialization is a very compact and accurate method. For any object to be serialized .it must be an instance of a class that implements either the Serializable or Externalizable interface.

Uses of serialization:
Helps to persist data for future use
To exchange data between servlets and applets
To store users session

How are Observer and Observable used?

The observer pattern in java is known for its use in design. Whenever an observable object changes its state, its corresponding observer classes are notified. Observable is implemented as a class which includes methods for managing Observer lists and notifying Observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state.  For example, third-party software cannot be made Observable without changing an existing class hierarchy.

What is synchronization and why is it important?

Java supports multiple threads to be executed. This may cause two or more threads to access the same fields or objects. Synchronization is a process which keeps all concurrent threads in execution to be in synch. Synchronization avoids memory consistence errors caused due to inconsistent view of shared memory. When a method is declared as synchronized; the thread holds the monitor for that method's object. If another thread is executing the synchronized method, your thread is blocked until that thread releases the monitor.

Does garbage collection guarantee that a program will not run out of memory?

Garbage collection does not guarantee that a program will not run out of memory. The garbage collection is dependant on the JVM. Hence it is possible for the resources to be used faster than they are garbage collected. Garbage collection cannot be predicted if it will happen or not.

 What is the difference between a break statement and a continue statement?

A break statement when applied to a loop ends the statement. A continue statement ends the iteration of the current loop and returns the control to the loop statement. If the break keyword is followed by an identifier that is the label of a random enclosing statement, execution transfers out of that enclosing statement. If the continue keyword is followed by an identifier that is the label of an enclosing loop, execution skips to the end of that loop instead.

What are synchronized methods and synchronized statements?

Synchronized methods

When a method in Java needs to be synchronized, the keyword synchronized should be added.
Public synchronized void increment()

Synchronization does not allow invocation of this Synchronized method for the same object until the first thread is done with the object. Synchronization allows having control over the data in the class.

Synchronized Statement:

A synchronized Statement can only be executed once the thread has obtained a lock for the object or the class that has been referred to in the statement. Synchronized statement contains a synchronized block, within which is placed objects and methods that are to be synchronized.

public void run()
            //synchronize statement. P1 here is an object of some class P


What happens to the static fields of a class during serialization?

There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization 
ignores static fields, because they are not part of ay particular state state.
2. Base class fields are only handled if the base class itself is serializable.
3. Transient fields.

What is the difference between error and an exception?

An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. These JVM errors and you can not repair them at runtime. While exceptions are conditions that occur because of bad input etc. e.g. FileNotFoundException will be thrown if the specified file does not exist. Or a NullPointerException will take place if you try using a null reference. In most of the cases it is possible to recover from an exception (probably by giving user a feedback for entering proper values etc.).

If I write return at the end of the try block, will the finally block still execute?

Yes even if you write return as the last statement in the try block and no exception occurs, the finally block will execute. The finally block will execute and then the control return.

If I write System.exit (0); at the end of the try block, will the finally block still execute?

No in this case the finally block will not execute because when you say System.exit (0); the control immediately goes out of the program, and thus finally never executes.

Does garbage collection guarantee that a program will not run out of memory?

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection

What is the purpose of finalization?

The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

What is the difference between static and non-static variables?

A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

What is daemon thread and which method is used to create the daemon thread?

Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system. setDaemon method is used to create a daemon thread.

What are the steps in the JDBC connection?

While making a JDBC connection we go through the following steps :

Step 1 : Register the database driver by using :
Class.forName(\" driver classs for that specific database\" );
Step 2 : Now create a database connection using :
Connection con = DriverManager.getConnection(url,username,password);
Step 3: Now Create a query using :
Statement stmt = Connection.Statement(\"select * from TABLE NAME\");
Step 4 : Exceute the query :

Is Empty .java file a valid source file?

Yes, an empty .java file is a perfectly valid source file.