당신은 나에게서 5개의 논리 문제와 4개의 Java 문제를 분석해야 합니다. 인터뷰 과정에서 발생한 문제와 해결 방법은 인터넷을 통해 확인할 수 있습니다. 인터뷰 중에 만난 사람들의 상위 목록을 알려 드리겠습니다.
인터뷰 중 받은 질문을 다루려면:
-
Java에서 싱글톤을 구현하는 여러 가지 방법을 작성합니다.
-
이 코드에서는 어떤 일이 일어날까요?
class MyExc1 extends Exception{} class MyExc2 extends Exception{} class MyExc3 extends Exception{} public class Test { public static void main(String[] args) throws Exception { try { System.out.print(1); p(); }catch (MyExc2 e){ } finally { throw new MyExc3(); System.out.print(2); } } public static void p() throws Exception { try { throw new MyExc1(); } catch (MyExc1 myExc1) { throw new MyExc2(); }finally { System.out.println(3); } } }
-
나에게 문제가 있습니다. 어떤 예가 있었는지 기억이 나지 않기 때문입니다.
public class Test { public static void main(String[] args) { String s = "Hello"; String s1 = "Hello"; String s2 = new String("Hello"); System.out.println(s == s1); System.out.println(s1 == s2); Integer i = 111; Integer i1 = 111; Integer i2 = new Integer(111); Integer i3 = new Integer(111); Integer i4 = -129; Integer i5 = -129; Integer i6 = new Integer(-129); System.out.println(i == i1); System.out.println(i1 == i2); System.out.println(i2 == i3); System.out.println(i4 == i5); System.out.println(i5 == i6); System.out.println(i6 == -129); } }
-
프로그램을 실행하면 어떤 결과가 나올까요? 그리고 마지막 두 줄의 주석을 제거하면 어떤 결과를 얻게 될까요?
class Test{ private int id; private Integer id2; public Test(int id, Integer id2) { System.out.println("Создаем екзепляр Test"); this.id = id; this.id2 = id2; } public Integer doIt(){ return id + id2; } } class Test1{ private Test test; private static int i; public Test1() { System.out.println("Создаем екзепляр Test1"); this.test = new Test(i, 10); } public Test getTest() { return test; } } class Main { public static void main(String[] args) { Test1 test1 = new Test1(); System.out.println(test1.getTest().doIt()); // Test test = new Test(null, 1); // test.doIt(); } }
GO TO FULL VERSION