How to represent infinity in Java

2 Answers

0 votes
package javaapplication1;
 
public class Example {
    public static void main(String[] args) {

        double inf;
        
        inf = Double.POSITIVE_INFINITY;
	
        System.out.println(inf);
    }
}
 
/*
run:
  
Infinity
  
*/

 



answered Apr 3, 2016 by avibootz
0 votes
package javaapplication1;
 
public class Example {
    public static void main(String[] args) {

        double inf;
        
        inf = Double.NEGATIVE_INFINITY;
	
        System.out.println(inf);
    }
}
 
/*
run:
  
-Infinity
  
*/

 



answered Apr 3, 2016 by avibootz

Related questions

1 answer 302 views
1 answer 264 views
2 answers 363 views
363 views asked Apr 2, 2016 by avibootz
2 answers 347 views
347 views asked Apr 2, 2016 by avibootz
2 answers 302 views
302 views asked Sep 9, 2016 by avibootz
1 answer 273 views
273 views asked Apr 3, 2016 by avibootz
...