This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Can anyone, please explain me Types.DOUBLE and Types.DECIMAL etc.. in java.sql package.I'm a novice please help me out.
And other question is " Why we are writing interfaces even though they doesn't contain methods ?" Are they only for imposing implementation on classes ?
You should read doc of Types to know what it is for :
The class that defines the constants that are used to identify generic SQL types, called JDBC types.
In eclipse it is simply needed to move and stop mouse over class name to see its doc.
If it is not available then you need to download the sources.
" Why we are writing interfaces even though they doesn't contain methods ?"
Simply to make several classes have the same type. Then we may check if instance belongs to that type by instanceof operator.
For instance if class implements Serializable it means that it can be used in java serialization methods.
Serializable describes feature of class that is class can be serialized.
Interfaces exist to make client independent on implementation as the same interface can be implemented by many classes.