Java | Tests
1.82K subscribers
1 photo
1 link
Проверь свои знания в Java

✍️По всем вопросам: @Pascal4eg
Download Telegram
public class Test {
public static void main(String[] args) {
System.out.println(true ^ true & false);
}
}
💯1
Что выведет код? 👆
Anonymous Quiz
36%
true
35%
false
29%
<Ошибка компиляции>
🎉1
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();
}
}
❤2
Что выведет код? 👆
Anonymous Quiz
23%
0
38%
5
25%
10
14%
<Ошибка компиляции>
❤3👍2🎉1
public class Test {
public static void main(String[] args) {
int x = 1;
System.out.println("x+1 = " + x+1);
}
}
❤2💯1
Что выведет код? 👆
Anonymous Quiz
42%
x+1 = 2
41%
x+1 = 11
17%
<Ошибка компиляции>
❤2🎉2
public class Test {
public static void main(String[] args) {
int i = 0;
method(i);
System.out.print(i);

StringBuilder sb = new StringBuilder();
sb.append("1");
method2(sb);
System.out.print(sb);
}

public static void method(int val) {
val = 1;
}

public static void method2(StringBuilder sb) {
sb.append("2");
sb = new StringBuilder();
sb.append("3");
}
}
❤1💯1
Что выведет код? 👆
Anonymous Quiz
19%
13
25%
012
10%
112
19%
0123
27%
03
❤2🔥1🎉1
public class Test {
public static void main(String[] args) {
System.out.println(cond(1) && cond(2));
}

private static boolean cond(int i) {
try {
return false;
} finally {
System.out.print(i);
}
}
}
❤1
Что выведет код? 👆
Anonymous Quiz
17%
12false
41%
1false
28%
false12
14%
false1
🎉2❤1
public class Test {
public static void main(String[] args) {
String s = null;
if (s != null & s.length() > 0) {
System.out.println("FULL");
} else {
System.out.println("EMPTY");
}
}
}
❤4🥰1
public class ShadesOfGray {
public static void main(String[] args) {
System.out.println(X.Y.Z);
}
}

class X {
static class Y {
static String Z = "BLACK";
}
static C Y = new C();
}

class C {
String Z = "WHITE";
}
❤1
Что выведет код? 👆
Anonymous Quiz
29%
BLACK
26%
WHITE
44%
<Ошибка компиляции>
✍3🎉1
public class Test {
public static void main(String[] args) {
System.out.println(calc());
}

static int calc() {
try {
if (1 == 1)
throw new RuntimeException();
return 1;
} catch (Exception e) {
return 2;
} finally {
return 3;
}
}
}
❤1
Что выведет код? 👆
Anonymous Quiz
9%
1
6%
2
69%
3
16%
<Ошибка компиляции>
❤2👍1🎉1
public class Test {

public static void main(String[] args) {
System.out.print(and1() && and2() && and3());
}

private static boolean and1() {
System.out.print(1);
return false;
}

private static boolean and2() {
System.out.print(2);
return true;
}

private static boolean and3() {
System.out.print(3);
return false;
}

}
❤1
Что выведет код? 👆
Anonymous Quiz
62%
1false
6%
12true
7%
123true
24%
123false
🎉2❤1
public class Test {
public static void main(String[] args) {
System.out.println(5 + true);
}
}
❤1