When Java programming language was released, developers around the world were very excited with this event. With Java you can easily work on every popular software that is in common today. This language has many unusual functions and features, which could help you while working.
However, even the greatest developers can`t know everything about Java. All forums and social media are filled with different questions concerning functions, codes and other things. We`ve collected top 10 java interview questions and answers for these questions.
- Question: can you explain the meaning of JDK, JRE and JVM? Answer: JDK is a Java Virtual Machine. It provides runtime environment for JBC (Java Byte Codes) to execute. JRE is Java Runtime Environment and it includes sets of files during the runtime of JVM. JDK (Java Development Kit) consist to JRE with other tools needed for writing and executing the program.
- Question: can you name the advantages of JSON over XML? Answer: there are some advantages which we can discuss. For example, JSON is better for the beginners to understand. JSON is smarter and lighter than XML.
- Question: can you explain the meaning of data encapsulation what where is it`s significance? Answer: Encapsulation is a Concept in Object Oriented Programming. It is used to combine the properties and methods in a single unit. With encapsulation developers could easily follow a modular approach because each object has the concrete set of methods and variables.
- Question: What is an Infinite Loop? Answer: An Infinite Loop could run without any condition. It could be broken by defining any breaking logic in the body of blocks.
- Question: Can you please explain the difference between double and float variables in Java? Answer: the difference is in the amount of memory they take. Float takes 4 bytes of the memory and Double will take 8 bytes.
- Question: What is the base class in Java from which all classes are derived? Answer: It`s the class named “java.leng.object”.
- Question: Is there a possibility of passing an argument to a function by reference instead of passing by value? Answer: While working with Java, we can pass an argument to function only by value.
- Question: Can you name the difference between an array and Vector? Answer: array is always in static and it can group data only by primitive way. In that time, Vector has different types of holding the data and it is always in action.
- Question: What are the two environment variables that we must set to run any Java program? Answer: these variables are PATH variable and CLASSPATH variable.
- Question: Can we use variables without initialization? Answer: we always need to make an initialization because without it program doesn`t compile and will give an error.
That is our top of questions. We hope you found in interesting. You can also look for Java server side programming interview questions because they are also very popular among users.