Pages

Tuesday, December 21, 2010

Java Framework Inventors

Here are the top 8 Java people, they’re created frameworks, products, tools or books that contributed to the Java community, and changed the way of coding Java.



8. Tomcat & Ant Founder




James Duncan Davidson, while he was software engineer at Sun Microsystems (1997–2001), created Tomcat Java-based web server, still widely use in most of the Java web projects, and also Ant build tool, which uses XML to describe the build process and its dependencies, which is still the de facto standard for building Java-based Web applications.
Related Links
1. James Duncan Davidson Twitter
2. James Duncan Davidson Wiki
3. James Duncan Davidson personal blog
4. Apache Ant
5. Apache Tomcat


7. Test Driven Development & JUnit Founder



Kent Beck, creator of the Extreme Programming and Test Driven Development software development methodologies. Furthermore, he and Erich Gamma created JUnit, a simple testing framework, which turn into the de facto standard for testing Java-based Web applications. The combine of JUnit and Test Driven Development makes a big changed on the way of coding Java, which causes many Java developers are not willing to follow it.
Related Links
1. Kent Beck Twitter
2. Kent Beck Wiki
3. Kent Beck Blog
4. JUnit Testing Framework
5. Extreme Programming Wiki
6. Test Driven Development Wiki
News & Interviews
1. Kent Beck: “We thought we were just programming on an airplane”
2. Interview with Kent Beck and Martin Fowler
3. eXtreme Programming An interview with Kent Beck
Kent Beck Books
1. Extreme Programming Explained: Embrace Change (2nd Edition)
2. Refactoring: Improving the Design of Existing Code
3. JUnit Pocket Guide



6. Java Collections Framework



Joshua Bloch, led the design and implementation of numerous Java platform features, including JDK 5.0 language enhancements and the award-winning Java Collections Framework. In June 2004 he left Sun and became Chief Java Architect at Google. Furthermore, he won the prestigious Jolt Award from Software Development Magazine for his book, “Effective Java”, which is arguably a must read Java’s book.
Related Links
1. Joshua Bloch Twitter
2. Joshua Bloch Wiki
News & Interviews
1. Effective Java: An Interview with Joshua Bloch
2. Rock Star Josh Bloch
Joshua Bloch Books
1. Effective Java (2nd Edition)
2. Java Concurrency in Practice



5. JBoss Founder




Marc Fleury, who founded JBoss in 2001, an open-source Java application server, arguably the de facto standard for deploying Java-based Web applications. Later he sold the JBoss to RedHat, and joined RedHat to continue support on the JBoss development. On 9 February 2007, he decided to leave Red Hat to pursue other personal interests, such as teaching, research in biology, music and his family.
Related Links
1. Marc Fleury Wiki
2. Marc Fleury Blog
3. JBoss Application Server
News & Interviews
1. Could Red Hat lose JBoss founder?
2. JBoss founder Marc Fleury leaves Red Hat, now what?
3. JBoss’s Marc Fleury on SOA, ESB and OSS
4. Resurrecting Marc Fleury


4. Struts Founder





Craig Mcclanahan, creator of Struts, a popular open source MVC framework for building Java-based web applications, which is arguably that every Java developer know how to code Struts. With the huge success of Struts in early day, it’s widely implemented in every single of the old Java web application project.
Related Links
1. Craig Mcclanahan Wiki
2. Craig Mcclanahan Blog
3. Apache Struts
News & Interviews
1. Interview with Craig McClanahan
2. Struts Or JSF?


3. Spring Founder




Rod Johnson, is the founder of the Spring Framework, an open source application framework for Java, Creator of Spring, CEO at SpringSource. Furthermore, Rod’s best-selling Expert One-on-One J2EE Design and Development (2002) was one of the most influential books ever published on J2EE.
Related Links
1. Rod Johnson Twitter
2. Rod Johnson Blog
3. SpringSource
4. Spring Framework Wiki
News & Interviews
1. VMware.com : VMware to acquire SpringSource
2. Rod Johnson : VMware to acquire SpringSource
3. Interview with Rod Johnson – CEO – Interface21
4. Q&A with Rod Johnson over Spring’s maintenance policy changes
5. Expert One-on-One J2EE Design and Development: Interview with Rod Johnson
Rod Johnson Books
1. Expert One-on-One J2EE Design and Development (Programmer to Programmer)
2. Expert One-on-One J2EE Development without EJB


2. Hibernate Founder



Gavin King, is the founder of the Hibernate project, a popular object/relational persistence solution for Java, and the creator of Seam, an application framework for Java EE 5. Furthermore, he contributed heavily to the design of EJB 3.0 and JPA.
Related Links
1. Gavin King Blog
2. Hibernate Wiki
3. Hibernate Framework
4. JBoss seam
News & Interviews
1. Tech Chat: Gavin King on Contexts and Dependency Injection, Weld, Java EE 6
2. JPT : The Interview: Gavin King, Hibernate
3. JavaFree : Interview with Gavin King, founder of Hibernate
4. Seam in Depth with Gavin King
Gavin King Books
1. Java Persistence with Hibernate
2. Hibernate in Action (In Action series)


1. Father of the Java programming language



James Gosling, generally credited as the inventor of the Java programming language in 1994. He created the original design of Java and implemented its original compiler and virtual machine. For this achievement he was elected to the United States National Academy of Engineering. On April 2, 2010, he left Sun Microsystems which had recently been acquired by the Oracle Corporation. Regarding why he left, Gosling wrote on his blog that “Just about anything I could say that would be accurate and honest would do more harm than good.”

Friday, December 3, 2010

Explain the term 'architecture of the application'?

Architecture is the set of rules (or framework) to bring in some common way of assembling or using J2EE components in the application. This helps in bringing consistency between codes developed by various developers in the team.

Monday, October 18, 2010

Java Deveoper 2010

Adam Bien: Java Developer of the Year (2010). This is one award announced by Oracle this year.

Wednesday, September 15, 2010

Mobile Devices

CDMA

Code-Division Multiple Access.

CDMA is a digital wireless technology. It is a general type of technology, implemented in many specific technologies. But the term "CDMA" is also commonly used to refer to one specific family of technologies (IS-95 and CDMA2000) used in the US by Sprint and Verizon Wireless. This technology competes with GSM, used by AT&T and T-Mobile.

CDMA is a "spread spectrum" technology, which means that it spreads the information contained in a particular signal of interest over a much greater bandwidth than the original signal.

Unlike many competing technologies, CDMA has no hard limit for the number of users who may share one base station (tower). Instead, with CDMA, additional users can connect until the base station determines that call quality would suffer beyond a set limit.

CDMA (IS-95) systems have been in commercial operation since 1995. CDMA networks operate in the 800 and 1900 MHz frequency bands with primary markets in the Americas and Asia.

IS-95 CDMA technology has also been called cdmaOne and cdma2000.

GSM

Global System for Mobile Communication.

GSM is the dominant 2G digital mobile phone standard for most of the world. It determines the way in which mobile phones communicate with the land-based network of towers.

GSM is one of two major mobile phone technologies in the U.S. The other is CDMA. AT&T and T-Mobile use GSM. Sprint and Verizon use CDMA. GSM is more prevalent in most other parts of the world, and especially in Europe.

Although GSM and CDMA provide similar basic features and services to end-users, (such as voice calling, text messaging, and data services,) they operate very differently at many technical levels. This makes GSM phones completely incompatible with CDMA networks, and vice-versa.

The most visible feature of GSM are SIM cards. SIM cards are removable, thumbnail-sized smart cards which identify the user on the network, and can also store information such as phone book entries. SIM cards allows users to switch phones by simply moving their SIM card from one phone to the other.

WCDMA

(Wideband Code Division Multiple Access)

Wideband CDMA is a third-generation (3G) wireless standard which utilizes one 5 MHz channel for both voice and data, initially offering data speeds up to 384 Kbps. WCDMA is the 3G technology used in the US by AT&T and T-Mobile.

There are several newer technologies that offer much faster data speeds, such as HSDPA, HSUPA, and HSPA. These do not replace WCDMA, but rather build on and enhance WCDMA. Therefore any phone with HSDPA also includes WCDMA by definition.

WCDMA is also referred to as UMTS - the two terms are effectively interchangeable.

WCDMA is the 3G standard that most GSM carriers are moving to. Parts of the WCDMA standard are based on GSM technology. WCDMA networks are designed to integrate with GSM networks at certain levels. Most WCDMA phones include GSM as well, for backward compatibility.

WCDMA borrows certain technology ideas from CDMA, as the name implies, but is in fact very different and incompatible with phones and networks using "CDMA" technology.

In Europe and Asia, WCDMA is being deployed in the all-new 2100 MHz frequency band. In North America, WCDMA is being deployed in the existing 1900 MHz (PCS) and 850 MHz (cellular) bands, as well as the newer 1700 MHz (AWS) band.


3G

3G Stands for 3rd-generation. Analog cellular phones were the first generation. Digital phones marked the second generation (2G).

3G is loosely defined, but generally includes high data speeds, always-on data access, and greater voice capacity.

The high data speeds are possibly the most prominent feature, and certainly the most hyped. They enable such advanced features as live, streaming video.

There are several different 3G technology standards. The most prevalent worldwide is UMTS, which is based on WCDMA. (The terms WCDMA and UMTS are often used interchangeably.) UMTS is the 3G technology of choice for most carriers that used GSM as their 2G technology.

The other major standard is cdma2000, which is an evolution of CDMA 2G technology. There are several types of cdma2000, each offering different data rates and levels of compatibility with 2G CDMA. EV-DO Rev A is the most common today.


UMTS

Universal Mobile Telecommunications System.

A third generation (3G) mobile communications technology that promises data transmission speeds of up to 2 megabits per second (Mbps), although actual speeds may be significantly lower at first, due to network capacity restrictions.

UMTS uses WCDMA technology, and the two terms are often used interchangeably with each other.

PCS

(Personal Communications Services)

1. The FCC-licensed frequency band near 1900 MHz.

2. A marketing term used to describe a wide variety of two-way digital wireless service offerings operating at 1900 MHz.

Wednesday, August 11, 2010

5 things you didn't know about ... JARs

Put it in a JAR

Normally, you build a JAR file after your code source has been compiled, collecting the Java code (which has been segregated by package) into a single collection via either the jar command-line utility, or more commonly, the Ant jar task. The process is straightforward enough that I won't demonstrate it here, though later in the article we'll return to the topic of how JARs are constructed. For now, we just need to archive Hello, a stand-alone console utility that does the incredibly useful task of printing a message to the console, shown in Listing 1:

Listing 1. Archiving the console utility

package com.tedneward.jars;

public class Hello
{
public static void main(String[] args)
{
System.out.println("Howdy!");
}
}


The Hello utility isn't much, but it's a useful scaffold for exploring JAR files, starting with executing the code.


1. JARs are executable

Languages like .NET and C++ have historically had the advantage of being OS-friendly, in that simply referencing their name at the command-line (helloWorld.exe) or double-clicking their icon in the GUI shell would launch the application. In Java programming, however, a launcher application — java — bootstraps the JVM into the process, and we have to pass a command-line argument (com.tedneward.Hello) indicating the class whose main() method we want to launch.

These additional steps make it harder to create user-friendly applications in Java. Not only does the end user have to type all of these elements at the command-line, which many end users would rather avoid, but chances are good that he or she will somehow fat-finger it and get an obscure error back.

The solution is to make the JAR file "executable" so that the Java launcher will automatically know which class to launch when executing the JAR file. All we have to do is introduce an entry into the JAR file's manifest (MANIFEST.MF in the JAR's META-INF subdirectory), like so:

Listing 2. Show me the entrypoint!

Main-Class: com.tedneward.jars.Hello



The manifest is just a set of name-value pairs. Because the manifest can sometimes be touchy about carriage returns and whitespace, it's easiest to use Ant to generate it when building the JAR. In Listing 3, I've used the manifest element of the Ant jar task to specify the manifest:

Listing 3. Build me the entrypoint!










All a user has to do to execute the JAR file now is specify its filename on the command-line, via java -jar outapp.jar. In the case of some GUI shells, double-clicking the JAR file works just as well.


2. JARs can include dependency information

It seems that word of the Hello utility has spread, and so the need to vary the implementation has emerged. Dependency injection (DI) containers like Spring or Guice handle many of the details for us, but there's still a hitch: modifying code to include the use of a DI container can lead to results like what you see in Listing 4:

Listing 4. Hello, Spring world!

package com.tedneward.jars;

import org.springframework.context.*;
import org.springframework.context.support.*;

public class Hello
{
public static void main(String[] args)
{
ApplicationContext appContext =
new FileSystemXmlApplicationContext("./app.xml");
ISpeak speaker = (ISpeak) appContext.getBean("speaker");
System.out.println(speaker.sayHello());
}
}


Because the -jar option to the launcher overwrites whatever happens to be in the -classpath command-line option, Spring needs to be on the CLASSPATH and in the environment variable when you run this code. Fortunately, JARs permit a declaration of other JAR dependencies to appear in the manifest, which implicitly creates the CLASSPATH without you having to declare it, shown in Listing 5:


Listing 5. Hello, Spring CLASSPATH!





value="./lib/org.springframework.context-3.0.1.RELEASE-A.jar
./lib/org.springframework.core-3.0.1.RELEASE-A.jar
./lib/org.springframework.asm-3.0.1.RELEASE-A.jar
./lib/org.springframework.beans-3.0.1.RELEASE-A.jar
./lib/org.springframework.expression-3.0.1.RELEASE-A.jar
./lib/commons-logging-1.0.4.jar" />





Notice that the Class-Path attribute contains a relative reference to the JAR files that the application depends on. You could also write this as an absolute reference or without a prefix entirely, in which case it would be assumed that the JAR files were in the same directory as the application JAR.

Unfortunately, the value attribute to the Ant Class-Path attribute has to appear in one line, because the JAR manifest can't cope with the idea of multiple Class-Path attributes. So, all of those dependencies have to appear on one line in the manifest file. Sure, it's ugly, but being able to java -jar outapp.jar is worth it!



3. JARs can be implicitly referenced

If you have several different command-line utilities (or other applications) that make use of the Spring framework, it might be easier to put the Spring JAR files into a common location that all of the utilities can reference. Doing so avoids having multiple copies of JARs popping up all over the filesystem. The Java runtime's common location for JARs, known as the "extension directory," is by default located in the lib/ext subdirectory, underneath the installed JRE location.

The JRE is a customizable location, but it is so rarely customized within a given Java environment that it's entirely safe to assume that lib/ext is a safe place to store JARs, and that they will be implicitly available on the Java environment's CLASSPATH.



4. Java 6 allows classpath wildcards

In an effort to avoid huge CLASSPATH environment variables (which Java developers should have left behind years ago) and/or command-line -classpath parameters, Java 6 introduced the notion of the classpath wildcard. Rather than having to launch with each and every JAR file explicitly listed on an argument, the classpath wildcard lets you specify lib/*, and all of the JAR files listed in that directory (not recursively), in the classpath.

Unfortunately, the classpath wildcard doesn't hold for the previously discussed Class-Path attribute manifest entry. But it does make it easier to launch Java applications (including servers) for developer tasks such as code-gen tools or analysis tools.


5. JARs hold more than code

Spring, like so many parts of the Java ecosystem, depends on a configuration file that describes how the environment should be established. As written, Spring depends on an app.xml file that lives in the same directory as the JAR file — but it's entirely common for developers to forget to copy the configuration file alongside the JAR file.

Some configuration files are editable by a sysadmin, but a significant number of them (such as Hibernate mappings) are well outside of the sysadmin's domain, which leads to deployment bugs. A sensible solution would be to package the config file together with the code — and it's doable because a JAR is basically a ZIP in disguise. Just include config files in the Ant task or the jar command-line when building a JAR.

JARs can also include other types of files, not just configuration files. For instance, if my SpeakEnglish component wanted to access a properties file, I could set that up like Listing 6:

Listing 6. Respond at random

package com.tedneward.jars;

import java.util.*;

public class SpeakEnglish
implements ISpeak
{
Properties responses = new Properties();
Random random = new Random();

public String sayHello()
{
// Pick a response at random
int which = random.nextInt(5);

return responses.getProperty("response." + which);
}
}


Putting responses.properties into the JAR file means that there's one less file to worry about deploying alongside the JAR file. Doing that just requires including the responses.properties file during the JAR step.

Once you've stored your properties in a JAR, though, you might wonder how to get them back. If the data desired is co-located inside the same JAR file, as it is in the previous example, then don't bother trying to figure out the file location of the JAR and crack it open with a JarFile object. Instead, let the class's ClassLoader find it as a "resource" within the JAR file, using the ClassLoader getResourceAsStream() method shown in Listing 7:

Listing 7. ClassLoader locates a Resource

package com.tedneward.jars;

import java.util.*;

public class SpeakEnglish
implements ISpeak
{
Properties responses = new Properties();
// ...

public SpeakEnglish()
{
try
{
ClassLoader myCL = SpeakEnglish.class.getClassLoader();
responses.load(
myCL.getResourceAsStream(
"com/tedneward/jars/responses.properties"));
}
catch (Exception x)
{
x.printStackTrace();
}
}

// ...
}


You can follow this procedure for any kind of resource: configuration file, audio file, graphics file, you name it. Virtually any file type can be bundled into a JAR, obtained as an InputStream (via the ClassLoader) and used in whatever fashion suits your fancy.


In conclusion

This article has covered the top five things most Java developers don't know about JARs — at least based on history and anecdotal evidence. Note that all of these JARs-related tips are equally true for WARs. Some tips (the Class-Path and Main-Class attributes in particular) are less exciting in the case of WARs, because the servlet environment picks up the entire contents of a directory and has a predefined entry point. Still, taken collectively, these tips move us beyond the paradigm of "Okay, start by copying everything in this directory ..." In so doing, they also make deploying Java applications much simpler.

Next up in this series: 5 things you didn't know about performance monitoring for Java applications.



Author: Ted Neward
Ref Site: http://www.ibm.com/developerworks/java/library/j-5things6.html

Tuesday, August 10, 2010

Java Best Practices

Quote 1: Avoid creating unnecessary objects and always prefer to do Lazy Initialization

Object creation in Java is one of the most expensive operation in terms of memory utilization and performance impact. It is thus advisable to create or initialize an object only when it is required in the code.
view source

01 public class Countries {
02
03 private List countries;
04
05 public List getCountries() {
06
07 //initialize only when required
08 if(null == countries) {
09 countries = new ArrayList();
10 }
11 return countries;
12 }
13 }
Quote 2: Never make an instance fields of class public

Making a class field public can cause lot of issues in a program. For instance you may have a class called MyCalender. This class contains an array of String weekdays. You may have assume that this array will always contain 7 names of weekdays. But as this array is public, it may be accessed by anyone. Someone by mistake also may change the value and insert a bug!
view source

1 public class MyCalender {
2
3 public String[] weekdays =
4 {"Sun", "Mon", "Tue", "Thu", "Fri", "Sat", "Sun"};
5
6 //some code
7
8 }

Best approach as many of you already know is to always make the field private and add a getter method to access the elements.
view source

1 private String[] weekdays =
2 {"Sun", "Mon", "Tue", "Thu", "Fri", "Sat", "Sun"};
3
4 public String[] getWeekdays() {
5 return weekdays;
6 }

But writing getter method does not exactly solve our problem. The array is still accessible. Best way to make it unmodifiable is to return a clone of array instead of array itself. Thus the getter method will be changed to.
view source

1 public String[] getWeekdays() {
2 return weekdays.clone();
3 }
Quote 3: Always try to minimize Mutability of a class

Making a class immutable is to make it unmodifiable. The information the class preserve will stay as it is through out the lifetime of the class. Immutable classes are simple, they are easy to manage. They are thread safe. They makes great building blocks for other objects.

However creating immutable objects can hit performance of an app. So always choose wisely if you want your class to be immutable or not. Always try to make a small class with less fields immutable.

To make a class immutable you can define its all constructors private and then create a public static method
to initialize and object and return it.
view source

01 public class Employee {
02
03 private String firstName;
04 private String lastName;
05
06 //private default constructor
07 private Employee(String firstName, String lastName) {
08 this.firstName = firstName;
09 this.lastName = lastName;
10 }
11
12 public static Employee valueOf (String firstName, String lastName) {
13 return new Employee(firstName, lastName);
14 }
15 }
Quote 4: Try to prefer Interfaces instead of Abstract classes

First you can not inherit multiple classes in Java but you can definitely implements multiple interfaces. Its very easy to change the implementation of an existing class and add implementation of one more interface rather then changing full hierarchy of class.

Again if you are 100% sure what methods an interface will have, then only start coding that interface. As it is very difficult to add a new method in an existing interface without breaking the code that has already implemented it. On contrary a new method can be easily added in Abstract class without breaking existing functionality.
Quote 5: Always try to limit the scope of Local variable

Local variables are great. But sometimes we may insert some bugs due to copy paste of old code. Minimizing the scope of a local variable makes code more readable, less error prone and also improves the maintainability of the code.

Thus, declare a variable only when needed just before its use.

Always initialize a local variable upon its declaration. If not possible at least make the local instance assigned null value.
Quote 6: Try to use standard library instead of writing your own from scratch

Writing code is fun. But “do not reinvent the wheel”. It is very advisable to use an existing standard library which is already tested, debugged and used by others. This not only improves the efficiency of programmer but also reduces chances of adding new bugs in your code. Also using a standard library makes code readable and maintainable.

For instance Google has just released a new library Google Collections that can be used if you want to add advance collection functionality in your code.
Quote 7: Wherever possible try to use Primitive types instead of Wrapper classes

Wrapper classes are great. But at same time they are slow. Primitive types are just values, whereas Wrapper classes are stores information about complete class.

Sometimes a programmer may add bug in the code by using wrapper due to oversight. For example, in below example:
view source

1 int x = 10;
2 int y = 10;
3
4 Integer x1 = new Integer(10);
5 Integer y1 = new Integer(10);
6
7 System.out.println(x == y);
8 System.out.println(x1 == y1);

The first sop will print true whereas the second one will print false. The problem is when comparing two wrapper class objects we cant use == operator. It will compare the reference of object and not its actual value.

Also if you are using a wrapper class object then never forget to initialize it to a default value. As by default all wrapper class objects are initialized to null.
view source

1 Boolean flag;
2
3 if(flag == true) {
4 System.out.println("Flag is set");
5 } else {
6 System.out.println("Flag is not set");
7 }

The above code will give a NullPointerException as it tries to box the values before comparing with true and as its null.
Quote 8: Use Strings with utmost care.

Always carefully use Strings in your code. A simple concatenation of strings can reduce performance of program. For example if we concatenate strings using + operator in a for loop then everytime + is used, it creates a new String object. This will affect both memory usage and performance time.

Also whenever you want to instantiate a String object, never use its constructor but always instantiate it directly. For example:
view source

1 //slow instantiation
2 String slow = new String("Yet another string object");
3
4 //fast instantiation
5 String fast = "Yet another string object";
Quote 9: Always return empty Collections and Arrays instead of null

Whenever your method is returning a collection element or an array, always make sure you return empty array/collection and not null. This will save a lot of if else testing for null elements. For instance in below example we have a getter method that returns employee name. If the name is null it simply return blank string “”.
view source

1 public String getEmployeeName() {
2 return (null==employeeName ? "": employeeName);
3 }
Quote 10: Defensive copies are savior

Defensive copies are the clone objects created to avoid mutation of an object. For example in below code we have defined a Student class which has a private field birth date that is initialized when the object is constructed.
view source

01 public class Student {
02 private Date birthDate;
03
04 public Student(birthDate) {
05 this.birthDate = birthDate;
06 }
07
08 public Date getBirthDate() {
09 return this.birthDate;
10 }
11 }

Now we may have some other code that uses the Student object.
view source

1 public static void main(String []arg) {
2
3 Date birthDate = new Date();
4 Student student = new Student(birthDate);
5
6 birthDate.setYear(2019);
7
8 System.out.println(student.getBirthDate());
9 }

In above code we just created a Student object with some default birthdate. But then we changed the value of year of the birthdate. Thus when we print the birth date, its year was changed to 2019!

To avoid such cases, we can use Defensive copies mechanism. Change the constructor of Student class to following.
view source

1 public Student(birthDate) {
2 this.birthDate = new Date(birthDate);
3 }

This ensure we have another copy of birthdate that we use in Student class.
Two bonus quotes

Here are two bonus Java best practice quotes for you.
Quote 11: Never let exception come out of finally block

Finally blocks should never have code that throws exception. Always make sure finally clause does not throw exception. If you have some code in finally block that does throw exception, then log the exception properly and never let it come out :)
Quote 12: Never throw “Exception”

Never throw java.lang.Exception directly. It defeats the purpose of using checked Exceptions. Also there is no useful information getting conveyed in caller method.
More Quotes from Java Developers

Do you have a quote that is not included in above list? Well, feel free to add your Java best practice quote using comment below. Write your quote and explain it in 2-3 lines. I will add all those user generated quotes in this section.
Quote #13: Avoid floating point numbers

It is a bad idea to use floating point to try to represent exact quantities like monetary amounts. Using floating point for dollars-and-cents calculations is a recipe for disaster. Floating point numbers are best reserved for values such as measurements, whose values are fundamentally inexact to begin with. For calculations of monetary amounts it is better to use BigDecimal.

Followed URL:

http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html