| 1. |
What is the output of the below program? |
|
Answer» public class StringTest {public STATIC void main(STRING[] args) { String str1 = new String("interviewbit"); String str2 = new String("INTERVIEWBIT"); System.out.println(str1 = str2);}} This program prints "INTERVIEWBIT" since str2 String is assigned to str1 String. The comparison operator “==” should not be confused with the assignment operator “=”. ConclusionHere's everything you need to know about Java String interview questions and answers. To summarize, there are many specifics RELATED to String that every Java programmer needs to be familiar with and these String questions will not just help you prepare better for Java interviews, but will also open a new door to learning more about String. The more familiar you are with these frequently asked interview questions, the greater your chances of getting hired. Hopefully, we were ABLE to answer any questions or concerns you had. Wishing you luck in your future endeavours. Recommended Interview Preparation Resources
|
|