Planning to Hire Freelance Java Developer? Top 11 Questions You Must Ask
Hiring a full stack senior freelance Java developer for a one-time project can turn out to be an expensive endeavor. This is why, lately, the trend of hiring freelancers is emerging in all industries that require the services of Java developers. Fortunately, there are enough of them on the market, willing to sell their services to the highest bidder. Businesses are now considering best freelance Java developers for hire on a diversity of small to large scale projects. Thanks to numerous online communities of freelance professionals, one can, nowadays, easily hire a Java programmer.
But, from the perspective of a business owner, it is not that easy to find a reliable freelance Java developer who will do the job perfectly and on time. Let’s get one thing straight right from the start. For experienced freelance Java developers, you will have to pay anywhere from 30-60 US dollars per hour.
Anyhow, it is better to ask some questions before you hand the project into the freelancer’s hands. These questions will help you determine who is the perfect freelance Java developer for you.
1) Are multitasking and multithreading the same thing?
The answer you should expect is a resounding no. If you get that answer, you should ask the developer to be more specific and to tell you more about both. Here is the answer you are looking for.
Multitasking refers to actions that include simultaneous activities on the computer. There are two types. The first one is named preemptive multitasking. The system automatically pre-empties the running process to another processor. In this scenario, the user is not involved. Non-preemptive multitasking is when the computer has to ask for the user’s confirmation before any process is executed.
On the other hand, multithreading means that the program can manipulate the functionality of multitasking. It divides the program into a thread. After that, each individual thread utilizes the CPU and memory resources as a standalone process. One process can contain multiple threads.
2) Which loop concepts are there in Java?
Loops are very commonly used in programming. A loop concept executes a line of code over and over. Basically, you will have to dig to find a program written in Java that doesn’t use any loops. The answer you are looking for is 3. And, here they are:
* For Loop – this is the standard loop concept. It is used to repeat a task a specific number of times. This loop is used when you know how many time the action has to be repeated.
* While Loop – programmers use this loop when there is the need to execute a line of code only when a certain condition is met. Before executing statements, this loop checks if the condition has been satisfied.
* Do-while Loop – this loop is a mirrored while loop concept. In this loop, statements are executed first, and the loop checks at the end if the conditions are met for breaking out of loop.
3) What are basic Java collections framework interfaces and their advantages?
Java developers must know about Collections as they are core building blocks for using data structures and it reduces development efforts, they are dynamic in size. They also supports thread safety and generic classes.
Experience freelance java developers must know about implementation of basic interface of collections framework and hands on practice of using following.
Map: Every object stored as key-value pair. Direct implementation of map are HasMap, HashTables, TreeMap. They are used based on requirements like concurrently, data ordering.
Set: Elements are stored with condition that no duplicate elements are allowed. Direct implementation of Set are HashSet, LinkedHashSet, TreeSet.
List: This collection allows duplicate elements to be stored, implementation of this collection framework is done via LinkedList, Vector and ArrayList.
4) How are the threads created? Which one do you use and why?
This is very important, as you want to hire the programmer who is able to build an app that most optimally uses all available resources. Threads can be created in three different ways:
* Extending a thread class
* Implementing a Runnable interface
* The application can create a thread pool by using the Executor framework
Experienced freelance Java developers prefer using a Runnable interface. When you use this interface, there will be no need for objects to inherit the thread class. If your application requires using multiple inheritance, the Java developer you are contacting should know that only interfaces can help you. A runnable interface is very easily implemented and improves the efficiency of your program.
5) How would you store the sensitive data of app users and why?
This answer will help you determine how well the developer is dedicated to their call and whether he or she can extend their knowledge for various purposes.
The answer you are looking for is storing the sensitive data in mutable objects, such as the character array. Once the data has been stored, you can set it to blank so that it is no longer retained in memory and available for exploiting by using a simple memory dump extraction. Storing sensitive data in strings is bad, end of story.
6) What should you avoid when designing an abstract class?
This is a tricky one. The answer you are looking for is avoiding calling abstract methods inside the abstract class constructor. The main problem here is the initialization order. The parent class has to run first, so that the subclass constructor can run as well.
The main reason why this should be avoided is because it places a restriction on how abstract methods can be implemented. If some variable assignments occur after the constructor runs, you will now have access to those in later instances.
7) You code compiles perfectly, but the library is causing the NoClassDefFoundError or NoSuchMethodError. What is going on?
Most Java projects incorporate countless dependencies. All of these dependencies are loaded on the same class path and, in order to handle them, one has to use specific tools, such as Gradle, Ivy, SBT, etc. Using this tools is important. Why? Because when using one of them, you can’t add multiple versions of the same library to the project.
The error messages from above get printed out when there are two libraries in the project that rely on different versions of the same dependency. This happens because Java doesn’t use static linking like some other programming languages do, like C++, for instance. Fixing this issue requires some time and patience. It is important to start from generating dependency reports so that one can see which JAR has a dependency to which libraries.
8) What are enums and how can they be used?
It is always good to check if the Java developer has extensive knowledge on the platform he or she uses. The answer you want to have here should be something like this.
Enums are classes. But, not just any classes; they are final classes with a fixed number of instances. Enums can’t extend another class but they can implement interfaces.
Enums should definitely be used instead of integer constants, as they are flexible and safe to use. Enums can be used in any instance where there is a need for strategy patterns.
9) In Java, can an interface extend to multiple interfaces?
This is a really, really tricky question. It will help you, as an interviewer, see if your candidate is able to think quickly. Also, being able to answer this questions requires extensive knowledge on polymorphism, classes, inheritance, objects, etc.
Java doesn’t have multiple inheritance. This is the main reason why many job candidates may answer “No” to this question. The fact is that this is quite possible and the answer should be yes. The class is the one that can’t extend multiple classes, while the interface can always extend to multiple interfaces.
Make sure not to give up on candidates that say “No” at first and change their answer later on, explaining why they have changed their mind. On the other hand, if you get a resounding “Yes”, make sure to ask why. Some people may know the answers by heart; trust us, you don’t want them developing software for you.
10) Tell me the difference between Errors, Unchecked Exception, and Checked Exception?
Knowing how to handle errors and exceptions is very important for every Java Developer. All of the above mentioned indicate something different. Handling exceptions is especially important when designing large applications.
Errors are more important and more significant than exceptions. They indicate that there is a serious problem that deserves immediate attention. Resolving errors is hard and it usually requires a significant amount of time.
Exceptions are objects. And, any object can be thrown as an exception as long as it is an object the classes of which descend from Throwable. There are two types of exceptions:
* Unchecked Exception – this one inherits from the RuntimeException and treated differently by the Java Virtual Machine. There are usually conditions that reflect errors in the program’s logic.
* Checked Exception – this one inherits from the Exception-class. These are invalid conditions in areas outside the immediate control of the program.
11) What are System.gc(), Runtime.gc() and finalize() methods for?
Resource management is quite important in modern Java development. By asking this question, you will check if your job applicant knows the basic garbage collector’s methods. Besides, this question is also a tricky one, because System.gc() and Runtime.gc() are effectively equivalent. There is some difference though; Runtime,gc() is an instance method while System.gc() is a class method. System.gc*() is more convenient for coding, and it suggests to the Java Virtual Machine to start garbage collection.
Finalize() method is called by the garbage collector. When using the finalize() method, it is advised to release resources that are being held by the object inside the finalize() method.
Well, there you go. If you get satisfying answers to all these questions, don’t lose time, hire the freelancer that has answered them. In case you still have any doubts or you generally feel unsure, interview more candidates. This way, you can compare them and go with the one that got all the answers right and seems the best for you to cooperate with.
In case this subject got you interested, and you want to find out about other means to find a perfect Java freelancer , feel free to read other articles online. Contact Finoit if you are looking to hire freelance Java developers or for a Java application development company. Finoit has experts Java developers and have delivered numerous enterprise projects.