Java for Beginner
711 subscribers
629 photos
172 videos
12 files
995 links
Канал от новичков для новичков!
Изучайте Java вместе с нами!
Здесь мы обмениваемся опытом и постоянно изучаем что-то новое!

Наш YouTube канал - https://www.youtube.com/@Java_Beginner-Dev

Наш канал на RUTube - https://rutube.ru/channel/37896292/
Download Telegram
Что выведет код?

public class Task300725 {
public static void main(String[] args) {
Object lock = new Object();

synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

System.out.println("Done");
}
}


#Tasks
👍1
Что выведет код?

import java.util.concurrent.*;

public class Task310725 {
public static void main(String[] args) throws Exception {
Callable<String> task = () -> "Result";
FutureTask<String> future = new FutureTask<>(task);

new Thread(future).start();
System.out.println(future.get());
}
}


#Tasks
👍4
Что выведет код?

import java.util.concurrent.CountDownLatch;

public class Task010825 {
public static void main(String[] args) throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);

new Thread(() -> {
latch.countDown();
latch.countDown();
}).start();

latch.await();
System.out.println("Completed");
}
}


#Tasks
👍1
Что выведет код?

import java.util.BitSet;

public class Task040825 {
public static void main(String[] args) {
BitSet bs1 = new BitSet();
bs1.set(65);

BitSet bs2 = new BitSet();
bs2.set(64);

bs1.and(bs2);
System.out.println(bs1.cardinality());
}
}


#Tasks
👍2
Что выведет код?

public class Task050825 {
public static void main(String[] args) {
int x = 5;

if (x > 10)
if (x < 20)
System.out.println("A");
else
System.out.println("B");
else if (x > 2)
if (x < 8)
System.out.println("C");
else
System.out.println("D");
else
System.out.println("E");
}
}


#Tasks
🗿5👍2
Что выведет код?

public class Task060825 {
public static void main(String[] args) {
int x = 1;
int y = 2;

if (++x > y++ ? x++ < --y : y-- > ++x) {
System.out.println("A: x=" + x + " y=" + y);
} else {
System.out.println("B: x=" + x + " y=" + y);
}
}
}


#Tasks
🤯1