Java задачки тесты
4.43K subscribers
162 photos
99 links
По вопросам рекламы: @anothertechrock


Если вы нашли ошибку в тесте - пишите @anothertechrock
Download Telegram
public class Test {

public static int VAL;

{
VAL = 5;
}

public Test() {
VAL = 10;
}

public static void print() {
System.out.println(VAL);
}

}

public class Quest {
public static void main(String[] args) {
Test.print();
}
}


Java задачки тесты | #quiz
👍4
public class Survive {
private Survive internalInstance = new Survive();

public Survive() throws Exception {
throw new Exception("I'm not coming out");
}

public static void main(String[] args) {
try {
Survive b = new Survive();
System.out.println("WIN!");
} catch (Exception ex) {
System.out.println("LOSE!");
}
}
}


Java задачки тесты | #quiz
public class Quest {
public static void main(String[] args) {
int i = Integer.MAX_VALUE;
i++;
if (i == 0) {
System.out.println("ZERO");
} else if (i == Integer.MIN_VALUE) {
System.out.println("MIN");
}
}
}


Java задачки тесты
| #quiz
👍6🥰1
public class Quest {
public static void main(String[] args) {
int i = 1;
inc(i);
System.out.println(i);
}
private static void inc(int num) {
num++;
}
}


Java задачки тесты | #quiz