KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > lang > Double

java.lang
Class Double

java.lang.Object
  extended by java.lang.Number
      extended by java.lang.Double
All Implemented Interfaces:
Serializable, Comparable<Double>
See Also:
Top Examples, Source Code

public byte byteValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static int compare(double d1,
                          double d2)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int compareTo(Double anotherDouble)
See Also:
Comparable, compareTo
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1000]Double comparison
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:41:53  Rate
Double d1 = new Double (  1  ) ; 
 Double d2 = new Double (  1  ) ; 
 Double d3 = new Double (  2  ) ; 
 Double d4 = new Double (  -2  ) ; 
  
  
 if (  d1.compareTo (  d2  )  == 0  )  
     System.out.println ( "Equal" ) ; 
 else {  
     System.out.println ( "Not Equal" ) ; 
     if (  d1.compareTo (  d2  )  == 1  )  
         System.out.println ( "d1 greater than d2" ) ; 
     else System.out.println ( "d1 less than d2" ) ; 
  }  
  
  
 if (  d1.compareTo (  d3  )  == 0 )  
     System.out.println ( "Equal" ) ; 
 else {  
     System.out.println ( "Not Equal" ) ; 
    if (  d1.compareTo (  d3  )  == 1  )  
         System.out.println ( " d1 greater than d3" ) ; 
     else System.out.println ( " d1 less than d3" ) ; 
  }  
 if (  d1.compareTo (  d4  )  == 0 )  
     System.out.println ( "Equal" ) ; 
 else {  
     System.out.println ( "Not Equal" ) ; 
    if (  d1.compareTo (  d4  )  == 1  )  
         System.out.println ( " d1 greater than d4" ) ; 
     else System.out.println ( " d1 less than d4" ) ; 
  }  
 //outputs the lines: 
 // Equal 
 // Not Equal 
 // d1 less than d3 
 // Not Equal 
 // d1 greater than d4 
 


public int compareTo(Object o)
See Also:
Comparable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Double(double value)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[403]Initializing double variable
By Anonymous on 2004/09/27 20:22:30  Rate
final double PI=3.1416;

[993]_
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:27:52  Rate
double d = 23.5; 
 Double d1 = new Double ( d ) ; 
  
  
 System.out.println (  d1.doubleValue (  )   ) ; 
  
  
 //outputs the line: 
 // 23.5 
 


public Double(String s)
       throws NumberFormatException
See Also:
valueOf(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[992]_
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:26:58  Rate
String s = "9.46"; 
 Double d1 = new Double ( s ) ; 
 double d = d1.doubleValue (  ) ; 
 System.out.println (  d  ) ; 
  
  
 //outputs the line: 
 // 9.46 
 


public static long doubleToLongBits(double value)
See Also:
longBitsToDouble(long)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static long doubleToRawLongBits(double value)
See Also:
longBitsToDouble(long)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public double doubleValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean equals(Object obj)
See Also:
doubleToLongBits(double)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[999]Double comparison
By parisjackson { at } yahoo { dot } com on 2005/06/13 12:41:17  Rate
Double d1 = new Double (  1.5  ) ; 
 Double d2 = new Double (  1.5  ) ; 
 Double d3 = new Double (  2.0  ) ; 
  
  
 if (  d1.equals (  d2  )   )  
     System.out.println ( "Equal" ) ; 
 else 
     System.out.println ( "Not Equal" ) ; 
  
  
 if (  d1.equals (  d3  )   )  
     System.out.println ( "Equal" ) ; 
 else 
     System.out.println ( "Not Equal" ) ; 
  
  
 //outputs the lines: 
 // Equal 
 // Not Equal 
 


[1485]_
By Anonymous on 2005/07/14 18:27:46  Rate
  public static void main ( String [  ]  args )  
    {   
     int neo = 0; 
     Examen ex=new  Examen (  ) ; 
     System.out.println ( "Tu hash es:" + ex.hashCode (  )   ) ; 
     if  ( neo.equals ( "18464898" )  )  
      {  
        
      }  
    } 


public float floatValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object), doubleToLongBits(double)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int intValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isInfinite()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean isInfinite(double v)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isNaN()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean isNaN(double v)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static double longBitsToDouble(long bits)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public long longValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final double MAX_VALUE
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[997]Check double max value
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:35:20  Rate
double d = Double.MAX_VALUE; 
 System.out.println (  d  ) ; 
  
  
 //outputs the line 
 // 1.7976931348623157E308 
 


public static final double MIN_VALUE
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[998]Check double min value
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:38:37  Rate
double d = Double.MIN_VALUE; 
 System.out.println (  d  ) ; 
  
  
 //outputs the line 
 // 4.9E-324 
 


public static final double NaN
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final double NEGATIVE_INFINITY
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static double parseDouble(String s)
                          throws NumberFormatException
See Also:
valueOf(String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final double POSITIVE_INFINITY
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public short shortValue()
See Also:
Number
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final int SIZE
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static String toHexString(double d)
See Also:
Integer.toString
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
toString(double), Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[994]Convert double to string
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:30:43  Rate
Double d1 = new Double (  99.999  ) ; 
   String s = d1.toString (  ) ; 
   System.out.println (  s  ) ; 
   //outputs the line: 
   // 99.999 
 


public static String toString(double d)
See Also:
NumberFormat, Integer.toString(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[995]_
By Jesse L { dot } Jackson - parisjackson { at } yahoo { dot } com on 2004/10/03 11:31:54  Rate
System.out.println (  Double.toString (  50.75  )   ) ; 
  
  
         //outputs the line: 
         // 50.75 
 


public static final Class<Double> TYPE
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Double valueOf(double d)
See Also:
Double(double)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Double valueOf(String s)
                      throws NumberFormatException
See Also:
NumberFormat, String.trim()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[996]Convert string to double
By Jesse L { dot } Jackson on 2005/04/09 22:35:57  Rate
String s = "14.25"; 
  Double d1 = Double.valueOf (  s  ) ; 
  System.out.println (  d1.toString (  )   ) ; 
  
  
         //outputs the line 
         // 14.25 
 

Popular Tags