File Name: java based interview questions and answers .zip
I was getting a lot of emails and comments to create java interview questions and answers PDF eBook. Below image shows the cover page of this eBook. Just subscribe to my newsletter and you will get this eBook first thing in the email.
What is the right data type to represent a price in Java? Answer: BigDecimal, if memory is not a concern and Performance, is not critical, otherwise double with predefined precision. What is a class in Java? Answer: Java encapsulates the codes in various classes which define new data types. These new data types are used to create objects.
What are the important features of Java 8 release? If you answer this question clearly, it will show that you like to keep yourself up-to-date with the latest technologies.
Java 8 has been one of the biggest releases after Java 5 annotations and generics. What is the numeric promotion? Answer : Numeric promotions of a numeric operator are used for the conversion of the operands into a common type. In order to perform calculation easily, numeric promotion, conversion is performed.
It is the conversion of a smaller numeric type to a larger numeric type so that integer and floating-point operations can be performed over it. The int values are converted to long values, and the long and float values are converted to double values. What are the methods used to implement for the key Object in the Hash Map? JIT compiles parts of the bytecode that has similar functionality which in turn reduces the amount of time needed for compilation.
Differentiate between a constructor and a method? Can we mark constructors final? Answer: A constructor constructs the value, by providing data for the object. It is a special type of method that is used to initialize the object.
The constructor has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. A method can be invoked using the dot operator and has its own name, and a return type. No, declaring the constructor as final is not possible. What is the final class? Answer : A final class is a constant value of a final variable. Extending A final class is not possible ie. A final method cannot be overridden when its class is inherited.
What is the multi-catch block in Java? Answer: Multi-catch block makes the code shorter and cleaner when every catch block has a similar code. We can catch multiple exceptions in a single catch block using this feature.
What are the important features of Java 10 release? Java 10 is mostly a maintenance release, however, I really liked the local variable type inference feature. What are the important features of Java 9 release?
Public : When a class is public, the public class is visible in other packages, the field is visible everywhere. Private: Private variables or methods can be used by an instance of the same class only which declares the variable or method. A private feature can be accessed by the class that owns the feature.
Protected: Protected variable is available to all classes in the same package. It is also available to all subclasses of the class that owns the protected feature. Subclasses that reside in a different package also is provided with access from the class that owns the protected feature. State the significance of public, private, protected class? Public: When a class is public, the public class is visible in other packages, the field is visible everywhere. Protected : Protected variable is available to all classes in the same package.
What is JVM and is it platform independent? JVM is responsible for converting byte code into machine-readable code. JDK provides all the tools, executables and binaries required to compile, debug and execute a Java Program. The execution part is handled by JVM to provide machine independence.
StringBuilder in Java was introduced in Java 5. What is Enum in Java? Answer: Enum was introduced in Java 1. Enum constants are implicitly static and final. Read more in detail at java enum. What are Java Annotations? Answer : Java Annotations provide information about the code and they have no direct effect on the code they annotate. Annotations are introduced in Java 5. Annotation is metadata about the program embedded in the program itself. It can be parsed by the annotation parsing tool or by the compiler.
We can also specify annotation availability to either compile-time only or till runtime also. Read more at java annotations. Answer : Java Reflection API provides the ability to inspect and modify the runtime behavior of java application. We can inspect a java class, interface, enum and get their methods and field details.
Reflection API is an advanced topic and we should avoid it in normal programming. Reflection API usage can break the design pattern such as Singleton pattern by invoking the private constructor i. They invoke the appropriate methods and instantiate classes through reflection API and use it a lot for other processing.
What is method overloading and method overriding? Answer: Method Overloading: In Method Overloading, Methods of the same class shares the same name but each method must have a different number of parameters or parameters having different types and order. It is a compile-time polymorphism. The methods must have a different signature. It may or may not need inheritance in Method Overloading. Online Java Training Courses. What is the difference between path and classpath variables?
Answer : PATH is an environment variable used by the operating system to locate the executables. Classpath is specific to Java and used by java executables to locate class files.
We can provide the classpath location while running java application and it can be a directory, ZIP files, JAR files, etc. What is the importance of main method in Java? Answer: main method is the entry point of any standalone java application. The syntax of main method is public static void main String args. The input parameter is an array of String through which we can pass runtime arguments to the java program.
Check this post to learn how to compile and run a java program. What is the static keyword? Answer: static keyword can be used with class-level variables to make it global i.
A static method can access only static variables of class and invoke only static methods of the class. What is finally and finalize in java? Answer: finally block is used with try-catch to put the code that you want to get executed always, even if an exception is thrown by the try-catch block.
This method gets called by the garbage collector when the object is getting garbage collected. This method is usually overridden to release system resources when object is garbage collected. What is an abstract class? Answer : Abstract classes are used in java to create a class with some default method implementation for subclasses.
An abstract class can have abstract method without body and it can have methods with implementation also. Read important points about abstract classes at java abstract class. What is the difference between Before and BeforeClass annotation? Answer : The code marker Before is executed before each test, while BeforeClass runs once before the entire test fixture.
If your text class has ten tests, Before code will be executed ten times, but BeforeClass will be executed only once. In general, you would use BeforeClass when numerous tests are required to share the same computationally expensive setup code. Starting a database connection falls into this category. You are able to move code from BeforeClass into Before, but your test run may be delayed.
BeforeClass is run as a static initializer, therefore it will run before the class instance of your test fixture is created. Is it possible to make an array volatile in Java? Answer: Yes, it is possible to make an array volatile in Java, but only the reference which is pointing to an array, not the whole array.
Therefore, if one thread changes the reference variable points to another array, which will provide a volatile guarantee. If the purpose is to provide memory visibility guarantee for individual indices of the array, volatile is of no practical use for you. Instead, you must rely on an alternative mechanism for thread-safety in that particular case, e. From the two, which would be easier to write: synchronization code for ten threads or two threads? Answer : Both will have the same level of complexity regarding writing the code because synchronization is independent of the number of threads, although the choice of synchronization could be subject to the number of threads because this presents more conflict.
Therefore, you would opt for an advanced synchronization technique, e.
There is the list of core Java interview questions. If there is any core Java interview question that has been asked to you, kindly post it in the ask question section. The answers to the Core Java interview questions are short and to the point. The core Java interview questions are categorized in Basics of Java interview questions, OOPs interview questions, String Handling interview questions, Multithreading interview questions, collection interview questions, JDBC interview questions, etc. Java is the high-level, object-oriented , robust, secure programming language, platform-independent, high performance, Multithreaded, and portable programming language.
What are the important features of Java 8 release? If you answer this question clearly, it will show that you like to keep yourself up-to-date with the latest technologies. Java 8 has been one of the biggest releases after Java 5 annotations and generics. What is the numeric promotion? Answer : Numeric promotions of a numeric operator are used for the conversion of the operands into a common type. In order to perform calculation easily, numeric promotion, conversion is performed. It is the conversion of a smaller numeric type to a larger numeric type so that integer and floating-point operations can be performed over it.
The main distinction between fail-fast and fail-safe iterators is whether or not the collection can be modified while it is being iterated. Fail-safe iterators allow this; fail-fast iterators do not. Fail-fast iterators operate directly on the collection itself. During iteration, fail-fast iterators fail as soon as they realize that the collection has been modified i.
Download PDF We have compiled the most frequently asked Java Interview Questions and Answers that will help you prepare for the Basic Java interview questions that an interviewer might ask you during your interview. In this list of Basic Java interview questions, we have covered all commonly asked basic and advanced Core Java interview questions with detailed answers to help you clear the job interview. The following list contains important Core Java interview questions for freshers as well as Java interview questions and answers for experienced programmers to help them prepare for the interview. This detailed guide of interview questions for Java Programming will help you to crack your Job interview easily. What is the difference between an Inner Class and a Sub-Class?
Download PDF We have compiled the most frequently asked Java Interview Questions and Answers that will help you prepare for the Basic Java interview questions that an interviewer might ask you during your interview. In this list of Basic Java interview questions, we have covered all commonly asked basic and advanced Core Java interview questions with detailed answers to help you clear the job interview. The following list contains important Core Java interview questions for freshers as well as Java interview questions and answers for experienced programmers to help them prepare for the interview.
Good questions but preparing just 15 20 questions won't be enough. See this mega list of Java interview questions for through preparation. When you say technical interview questions, what does that mean? I am assuming for Programming Job interviews most of the rounds are technical round be it written test, phone interview or face-to-face interview, only exception is HR interview which happens last. Let me know if you have different meaning for technical interview here. I would highly request to please answer question first instead of providing link links
Все внезапно осложнилось, пошло совсем не так, как он рассчитывал. Мелкая любезность, которую он оказал Стратмору, забрав личные вещи Танкадо, вылилась в поиски таинственного кольца, как в известной игре, где нужно находить спрятанные предметы. Дэвид только что позвонил Стратмору и рассказал о немецком туристе.
Беккер почувствовал тошноту. Это какая-то глупая шутка. Он не находил слов.
Хейл лично знаком с Танкадо. И снова постаралась держаться с подчеркнутым безразличием. - Он поздравил меня с обнаружением черного хода в Попрыгунчике, - продолжал Хейл. - И назвал это победой в борьбе за личные права граждан всего мира.
Если повезет, он разыщет канадца, получит кольцо и тут же вернется домой. Если потребуется, заплатите за это кольцо хоть десять тысяч долларов. Я верну вам деньги, - сказал ему Стратмор. В этом нет необходимости, - ответил на это Беккер.
- У Танкадо сказано: главная разница между элементами. - Господи Иисусе! - вскричал Джабба. - Откуда нам знать, что для Танкадо было главной разницей.