First Question:
Yazılım Soru - Kod Kısmı
package gakkos23.First;
public class Main {
public static void main(String[] args) {
Thread th1 = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("111");
}
});
Thread th2 = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("222");
}
});
th1.start();
th2.start();
}
}
Second Question:
Yazılım Soru - Kod Kısmı
package gakkos23.Second;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Lütfen Sayıyı Giriniz: ");
int sayi = scan.nextInt();
int lockedNumber = sayi;
while(true) {
if(sayi == 2 && sayi == 3 && sayi == 5 && sayi == 7) {
System.out.println("Yazdığınız zaten bir asal sayı!");
}
else if (sayi % 2 != 0 && sayi%3 != 0 && sayi%5 != 0 && sayi%7 != 0) {
System.out.println("Yazılan Sayı: " + lockedNumber + " En yakın Asal Sayı: " + sayi);
break;
}
sayi++;
}
}
}
Umut Özercan(Haxtar Soliterax) Professional Developer(JAVA, C#, C, C++, HTML, JS)