Вопросы с собеседований по Java и ответы на них.
По рекламе: @tproger_sales_bot
Учиться у нас: clc.to/3wECtA
Для обратной связи: @proglibrary_feeedback_bot
Post #138
2.03K
- ❤ 11
- 😁 4
- 👏 2
- 🥰 1
БИ @java_interview_lib
Showing posts older than #139 · Back to latest

void uncaughtException(Thread t, Throwable e);



public static void main(String[] args) {
byte x = 127;
x += 2;
System.out.println(x);
}public class MainClass {
public static void main(String args[]) {
new TestClass().a();
}
}public class TestClass {
public static String v = «Some val»;
{
System.out.println(»!!! Non-static initializer»);
}
static {
System.out.println(»!!! Static initializer»);
}
public void a() {
System.out.println(»!!! a() called»);
}
}class Victim {
private int field = 42;
}
//...
Victim victim = new Victim();
Field field = Victim.class.getDeclaredField(«field»);
field.setAccessible(true);
int fieldValue = (int) field.get(victim);
//...