Java Puzzle 21 – Infinity

Merhaba Arkadaslar,
Loop ile ugrasmaya devam ediyoruz.
Bu while dongusu number’in hangi durumu/degeri icin calisacaktir ?

    
     while (number == number + 1) {
     ///		
     }

Bu dongu number , infinite oldugu durumda calisir.Matematikte;

sonsuz = sonsuz+1;

DoubleInfinity.java

package _21.infinite.loop;

public class DoubleInfinity {

	public static void main(String[] args) {
		double i = 1.0 / 0;
		System.out.println(i); // Infinity

		double j = Double.POSITIVE_INFINITY;
		System.out.println(j);

		double k = Double.NEGATIVE_INFINITY;
		System.out.println(k);
	}
}

Infinity
Infinity
-Infinity

DoubleInfinityLoop.java

package _21.infinite.loop;

public class DoubleInfinityLoop {
	public static void main(String[] args) {

		double number = Double.POSITIVE_INFINITY;
		while (number == number + 1) {
			System.out.println("works or not ?");
		}
	}

}

Github kaynak kodlar / Source Code ;
leventerguder/injavawetrust-puzzler

Yazimi burada sonlandiriyorum.
Herkese Bol Javali Gunler dilerim.
Be an oracle man , import java.*;
Levent Erguder
OCP, Java SE 6 Programmer
OCE, Java EE 6 Web Component Developer

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *