Dec
1
2011

Oracle java download

Oracle sun 1.7 download

Linux x86 77.27 MB  jdk-7u1-linux-i586.rpm
 Linux x86 92.17 MB  jdk-7u1-linux-i586.tar.gz
 Linux x64 77.91 MB  jdk-7u1-linux-x64.rpm
 Linux x64 90.57 MB  jdk-7u1-linux-x64.tar.gz
 Solaris x86 154.78 MB  jdk-7u1-solaris-i586.tar.Z
 Solaris x86 94.75 MB > jdk-7u1-solaris-i586.tar.gz
 Solaris SPARC 157.81 MB  jdk-7u1-solaris-sparc.tar.Z
 Solaris SPARC 99.48 MB  jdk-7u1-solaris-sparc.tar.gz
 Solaris SPARC 64-bit 16.27 MB  jdk-7u1-solaris-sparcv9.tar.Z
 Solaris SPARC 64-bit 12.37 MB  jdk-7u1-solaris-sparcv9.tar.gz
 Solaris x64 14.68 MB  jdk-7u1-solaris-x64.tar.Z
 Solaris x64 9.38 MB  jdk-7u1-solaris-x64.tar.gz
 Windows x86 79.46 MB  jdk-7u1-windows-i586.exe
 Windows x64 80.24 MB  jdk-7u1-windows-x64.exe

 

Nov
30
2011

Struts 2 setup and beginning

Setting up first demo application

In this tutorial we will learn how to set up struts application and start the app in server.

The tutorials in these website are intend to deploy using Tomcat webserver. Download the Tomcat webserver from http://tomcat.apache.org. Once its downloaded extract or install the tomcat server in desired directory of yours.

Download latest version of Struts from http://struts.apache.org and extract the files from the downloaded file. The downloaded file will contain set of .war files which we will copy to web-apps folder of tomcat for building up our struts application. (more…)

Nov
23
2011

Struts 1.x Vs Struts 2.x

What is difference between struts 1.x and struts 2.x

In this article we will learn what is the difference between struts 1.x and struts 2.x


(more…)

May
24
2011

Java inner classes best practice

In java it’s not necessary that we can write separate file for each class. We can write class definition within another class. The inside class is called inner class and enclosing class is called outer class.

Where should we use inner class?

Best practice of inner class is, it’s should not be create without any specific reason. Because using inner class is cost to high maintainability and readable. When you create an inner class and accessing private data of the outer class, at the compilation time JDK create separate package-access member functions in the outer class for inner class to access the private members, this lead to a security hole. In general we should avoid using inner classes. Use inner class only when an inner class is only relevant in the context of the outer class and/or inner class can be made private so that only outer class can access it. Inner classes are used primarily to implement helper classes like Iterators, Comparators etc which are used in the context of an outer class.

(more…)

May
23
2011

How does Java allocate stack and heap memory in jvm

When each time a new object created in Java it goes into the area of memory known as heap. The primitive variables like int, long, float, double…Etc are allocated in the stack (i.e. Stack follow Last In First Out algorithm), if variables are local variables it places in stack and if variables are member variables (i.e. fields of a class) then it place in heap. In Java methods and its local variables are pushed into stack when a method is invoked and stack pointer is decremented when a method call is completed. (more…)

Apr
21
2011

Difference between shallow cloning and deep cloning of objects

When we do object’s cloning by default it is a shallow copy. But to achieve a deep copy the classes must be edited or adjusted. Below is the object example where it shows the difference between shallow cloning and deep cloning.  (more…)

Mar
21
2011

Best practices when implementing a user defined key

Best practices when you implement a user defined key. This is very important when you are using user defined key in collection. Below are the primary considerations when implementing a user defined key

  • If a class overrides equals(), it must override hashCode().
  • If 2 objects are equal, then their hashCode values must be equal as well.
  • If a field is not used in equals(), then it must not be used in hashCode().
  • If it is accessed often, hashCode() is a candidate for caching to enhance performance.
  • It is a best practice to implement the user defined key class as an immutable
Mar
21
2011

Best practices to equals() and hashCode() in java

Whenever you are working collections and you want you add key as your own defined classes then you must understand the best practices of equals() and hashCode() non final methods.

The equals() and hashCode() methods prove to be very important, when user defined class implements these two methods are added to collections. If you implement these methods incorrectly or not implemented at all then your objects stored in a collection like a Set, List or Map may behave strangely and its very difficult to debug. (more…)

Mar
17
2011

Best practices relating to Java collection

Best practices while using java collections

Use ArrayList, HashMap etc as opposed to Vector, Hashtable etc, where possible to avoid any synchronization overhead. Even better is to use just arrays where possible. If multiple threads concurrently access a collection and at least one of the threads either adds or deletes an entry into the collection, then the collection must be externally synchronized.

This is achieved by:
Map myMap = Collections.synchronizedMap (myMap); //conditional thread-safety
List myList = Collections.synchronizedList (myList); //conditional thread-safety

NOTE: use java.util.concurrent package for J2SE 5.0

(more…)

Pages:12»