Tag: core java interview question
-
What is the trade-off between using an unsorted array versus a sorted array ?
The tradeoff is in terms of speed. The major advantage of a sorted array is that to search an element in sorted array is faster. Sorted array has time complexity of O(log n), compared to that of an unsorted array, which is O (n). The disadvantage of a sorted array is that the insertion operation…
-
How to convert String to int in Java ?
In some cases there is a need to convert String to Integer. For example, when client is sending String for key’s value where Integer is expected. There are following two ways to do it: parseInt() This is a static method of Integer class. There are two overloaded methods: One major difference between two methods is…
