How well do you know your Java trivia?
Java has been around forever. It seems like there’s nothing about this old favorite that we don’t know about. But do you really know everything about Java? Test your knowledge about Java and find out!
Java technology has progressed and has become really huge in last decade. This long-lasting programming language remains immensely popular for good reason. It’s secure, simple and robust. But that’s just the tip of the iceberg. Let’s test your knowledge and find out if you really know all that there is to know about Java.
Let’s get down to the questions!
- What was Java originally called?
Answer: a) Oak! The earliest version of Java was known as Oak. This was inspired by a big oak tree that grew outside the window of the lead creator of Java, James Gosling. It was later changed to Java by Sun’s marketing department when Sun lawyers found that there was already a computer company registered as Oak.
- How many platforms does Java have?
Answer: c) Four! Java has 4 platforms: JavaStandard Edition, JavaEnterprise Edition, JavaMicro Edition, and JavaFX.
“Final” has many uses in Java. Which is incorrect?
a.) Final class – the class cannot be extended
b.) Final countdown – the time before a process starts
c.) Final field – the field is a constant
d.) Final method – the method cannot be overwritten
e.) Final variable – the value of the variable cannot be changed once assigned
Answer: b) Final countdown. But we’re all surprised that’s not true; Java really loves their “final X” format.
Can Java execute code in separate threads?
Answer: a) Yes! Unlike other popular programming language, Java includes the ability execute code in separate threads which is very important today. The Runnable interface and Thread classmake parallel code execution very easy and upfront. Having the ability to create multiple threads is only part of the solution to developing parallel code. Java provides an extensive set of tools to deal with this:
- A rich set of APIs to provide support for well-understood parallel-programming concepts through the concurrency utilities.
- The fork-join framework, which provides an easy and simple way of taking a large task that can be broken down into smaller sub-tasks and doing this recursively until the tasks are small enough to assign to a single thread.
- The latest additions in JDK 8 of lambda expressions and streams.This facilitates the task to be processed using a functional rather than imperative approach.
Java has a limited number of libraries.
Answer: b) No. Since Java has been around for so many years, many people have written libraries that support pretty much anything you can think. There are many libraries to support Java. Many of these libraries are released under an open-source license, which often means that they are free to use. Open source libraries ensure that Java can be used everywhere.
Apache, Google, and other organization have contributed lot of great libraries, which makes Java development easy, faster and cost effective. Some of the examples of Java Library are open JDK, jQuery, iText, Xalan, Apache Harmony, Open CV, Colt, YUI Library, Dojo Toolkit.
Java has a limited range.
Java is also the most trusted language for building an enterprise level application. Gmail & YouTube is built on Java, Twitter (Netty) & LinkedIn uses Java & Scala, and Amazon, EBay, and Blogger uses Java.Java is potentially the best programming language which is both highly secure and better at performance.
Java allows for dynamic changes.
Answer: a) Yes. There is something called as Java Instrumentation and Java Reflections which needs to be explored. Instrumentation allows you to change the already compiled classes. This is useful if you want to change the code at run time. There are open source libraries like AspectJ, ASM, Javassist, cglib etc that allows Java instrumentation. Using reflection you can access even private variables of a class. Similarly, Class.forName() loads a class at run time. This is extremely useful technique Java provides.
Lists and arrays are the same thing.
Answer: b) No. Java developers usually make the mistake of assuming that Array List is simply a replacement for the Java array. Collections are supported by arrays, which leads to good performance when looking up items randomly within a collection. And, like arrays, collections use integer-ordinals to obtain particular items. Still, a collection isn’t a drop-in replacement for an array. The trick to identifying collections from arrays is knowing the difference between order and position.
So, how well did you do? See where you stand in our little rankings!
0 – 3 correct: You’re just a Java beginner. Time to hit the books and do a bit more studying.
4-5 correct: You’re pretty solid in your Java history, but it might behoove you to pay a little more attention to the details.
6-7 correct: Nice! You know your stuff!
8 correct: You are a Java master.