Another good Java interview question, I think answer is not sufficient but here it is “Substring creates new object out of source string by taking a portion of original string”. see my post How SubString works in Java for detailed answer of this Java question. 5. Which two method you ne...
InterviewQuestion+answerQuestion() : voidDeveloper+interviewQuestion: InterviewQuestion+askQuestion() : voidJuniorDeveloper+answerQuestion() : void 3. 创建InterviewQuestion类 先创建InterviewQuestion类,该类包含一个answerQuestion方法,用于回答面试题。 publicclassInterviewQuestion{publicvoidanswerQuestion(){// TODO...
Another good question, I think answer is not sufficient but here it is “Substring creates new object out of string by taking a portion of original string”. suggested by Anand and Anonymous The substring() method is used to return a part (or substring) of the String used to invoke the ...
The String literal “abc” is not a primitive value. It is a String object. 24What restrictions are placed on the values of each case of a switch statement? During compilation, the values of each case of a switch statement must evaluate to a valuethat can be promoted to an int value. ...
Open to all. In my opinion throwing exception from constructor is an option.Answer:This is similar to previous interview question. Since constructor of Singleton class is supposed to beprivateit prevents creating instance of Singleton from outside butReflection can access private fields and methods,...
Java 8 has been released in March 2014, so it’s one of the hot topics in java interview questions. If you answer this question clearly, it will show that you like to keep yourself up-to-date with the latest technologies. Java 8 has been one of the biggest releases after Java 5 anno...
题源参见 Grokking The Java Developer Interview: Question 15: Difference between error and exception Answer: Error: Errors in a program are irrecoverable, they indicate that something severe has gone wrong in the application and the program gets terminated in case of error occurrence e.g. running ...
There is really only one canonical answer, so the interesting thing is to see how the candidate approaches the problem.The fact that max() should run in O(1) time is a clear hint that the maximum needs to be stored. Upon realizing this, the interview candidate might think they have ...
中级程序员的回答:高级程序员的回答:【关于基础内容】【关于设计模式】【关于编程思想、算法】所以Java...
题源参见 Grokking The Java Developer Interview: Question 15: Difference between error and exception Answer: Error: Errors in a program are irrecoverable, they indicate that something severe has gone wrong in the application and the program gets terminated in case of error occurrence e.g. running ...