Thursday, April 25, 2024

Top 21 jQuery interview Questions and Answers

Hello guys, if you are preparing for web developer interviews then preparing for jQuery questions can benefit you. While many people will say that jQuery is dead but its not dead and I am still working with projects which are using jQuery for little to big things. That's why its important to know about basic jQuery concepts and interview questions based upon that. In the past, I have shared several JavaScript and web development interview questions and in this article I am going to share jQuery questions like what is $() etc. What are selectors? how does they work etc. You can use this questions to quickly revise key jQuery concepts for interviews.  So what are we waiting for, let's see the basic jQuery interview questions for web developers.

Thursday, April 11, 2024

How String concatenation works in Java?

You can concatenate multiple String using + operator in Java. Even though Java doesn't support operator overloading, + operator is special, it performs addition if given operands are numeric and does String concatenation if one of them is String. Why it's important to know how String concatenation works? Well, more often that you can live without this knowledge but if you want to master Java then why not know little more detail. Apart from that it also helps you to avoid a performance mistake, which many Java devleoper do, concatenating String inside loop. When you concate two String literal e.g. "abc" + "cde" then compiler do this concatenation at compile time and this doesn't involve StringBuilder.


Concatenating two String literal



Concatenating String literal and String variable.




Things to remember:

1) Don't concatenate String in loop because Java creates a new StringBuilder() every iteration.

2) If two String literal are concatenated i.e. "Java" + "Script" then it happens at compilation time

2) When you concatenate a String literal and a String object, or two String object then it happens at runtime.




That's all about how String concatenation works in Java.