Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC double and decimal types

 
Abhishek Boppudi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic