|
|
|
|
|
|
How to use Enum in Switch?
Author :
AnupFrancis
Date : Thu Feb 19th, 2009
Prior to Java 1.4, switch only worked with int, short, char, and byte values. However, since enums have a finite set of values, Java 1.5 adds switch support for the enum. Here's an example of using an enum in a switch statement:
Adding methods to an Enum
Author :
AnupFrancis
Date : Thu Feb 19th, 2009
Enums introduced in Java 5.0 are just compiled java classes with some extra behaviour. So you can basically do whatever you can in a normal java class inside an enum as well. That includes adding methods , class level variables and constructors to an enum.
Volatile keyword in Java
Author :
Sutha
Date : Thu Feb 19th, 2009
If you are working with the multi-threaded programming, the volatile keyword will be more useful. When multiple threads using the same variable, each thread will have its own copy of the local cache for that variable. So, when it's updating the value, it is actually updated in the local cache not in the main variable memory. The other thread which is using the same variable doesn't know anything about the values changed by the another thread. To avoid this problem, if you declare a variable as volatile, then it will not be stored in the local cache. Whenever thread are updating the values, it is updated to the main memory. So, other threads can access the updated value.
What is transient keyword in Java?
Author :
Sutha
Date : Wed Feb 18th, 2009
If you want to understand what is transient, then first learn what is serilization concept in Java if you are not familiar with that. Serilization is the process of making the object's state persistent. That means the state of the object is converted into stream of bytes and stored in a file. In the same way we can use the de-serilization concept to bring back the object's state from bytes. This is one of the important concept in Java programming because this serilization is mostly used in the networking programming. The object's which are needs to be transmitted through network has to be converted as bytes, for that purpose ever class or interface must implements Serilization interface. It is a marker interface without any methods.
Ordering Queue Using Comparator Interface and PriorityQueue
Author :
AnupFrancis
Date : Wed Feb 18th, 2009
The basic use of Queue class is to provide a data structure which allows storing objects in a First in First out(FIFO) format. But sometimes one wants to maintain the ordering, based on some other metric. This is exactly the purpose of PriorityQueue, another Queue implementation. You provide it a Comparator, and it does the rest for you.
load-on-startup element in web.xml
Author :
Sutha
Date : Tue Feb 17th, 2009
This tips explains the few points on how to use the load-on-startup element on the web.xml file. When erver is starting, it is possible to tell the container to load a servlet on the startup. You can load any number of servlets on the startup. Normally this is done for any initialization purpose. Look into the following example:
SCJP 6.0 Certification – Rehearse It – Try It – Crack It with Dreamtech Press
Author :
JavaBeat
Date : Tue Dec 2nd, 2008
Along with the Study guide and Lab Manual, this book comes with a CD containing a Ucertify prepkit with four complete SCJP mock exam papers, study notes and customized test, which should be tried before appearing for the exam. The accompanying CD also contains two mock exams in PDF format and additional questions based on exam objectives.
Packt Publishing seeks authors for new Beginner’s Guide series
Author :
JavaBeat
Date : Tue Dec 2nd, 2008
Packt Publishing seeks authors for new Beginner’s Guide series
How to solve QuerySyntaxException (table is not mapped) in hibetnate?
Author :
JavaBeat
Date : Mon Dec 1st, 2008
The above QuerySyntaxException is thrown when we are not mapping the table name properly. The first time hibernate users
can be seen this error because you will map the table name directly in the query. That will not work in the hibernate. You will have to
map the class name that is mapped in the Hibernate configuration file. Look into the following example:
Many-to-One Relationship in Hibernate Mappings - Example
Author :
JavaBeat
Date : Fri Nov 28th, 2008
This example program demonstrates how to write the many-to-one accociations using the hibernate mapping files.
|
|
|
|
|
|
|