Java important interview questions and answers pdf

Posted on Wednesday, April 28, 2021 5:15:37 PM Posted by Daniel C. - 28.04.2021 and pdf, with pdf 4 Comments

java important interview questions and answers pdf

File Name: java important interview questions and answers .zip

Size: 29178Kb

Published: 28.04.2021

Java has been a perennial contributor to the software development domain. It is not only necessary to learn and master Java skills but also to practice these skills in real-time.

It's a no-brainer that Java is one of the leading programming options for bagging a lucrative job. After all, the class-based, general-purpose, object-oriented programming language is one of the most widely used programming languages in the world. So, here are top interview questions on Java and answers that will help you bag a Java job or, at the very least, enhance your learning.

Java Interview Questions and Answers PDF eBook Free Download (250+ Questions, 60 Pages)

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 is a JVM? Explain method overloading? Answer: When a Java program contains more than one methods with the same name but different properties, then it is called method overloading.

Does Java support multiple inheritances? What restrictions are placed on the location of a package statement within a source code file?

Answer: A package statement must appear as the first line in a source code file eliminating blank lines and comments. What is a transient variable? Answer: A transient variable is a variable that may not be serialized. Answer: These methods have been deprecated in JDK 1. What is the immediate superclass of the Applet class? Answer: The Panel class is the immediate superclass of the Applet class.

Can we rethrow the same exception from catch handler? Answer: Yes, we can rethrow the same exception from our catch handler. If we want to rethrow checked exception from a catch block we need to declare that exception. Answer: The default value of a String type is null. Which containers use a Flow Layout as their default layout? What modifiers may be used with an inner class that is a member of an outer class?

Answer: A non-local inner class may be declared as public, protected, private, static, final, or abstract. Which java. What is the Vector class? Answer: The term Vector class provides the ability to implement a growable array of objects. What is a native method? Answer: A native method is a method that is applied in a language other than Java.

What value does read Line return when it has reached the end of a file? Answer: The readLine method returns null when it has reached the end of a file. What is clipping? Answer: Clipping is the process of confining paint operations to a limited area or shape.

Can a for statement loop indefinitely? Answer: Yes, a for statement can loop indefinitely. For example, consider the following: for ;;. Explain Java Coding Standards for Constants? Answer: Constants in java are created using static and final keywords. What is synchronization and why is it important? Answer: The term synchronization is the ability to control the access of multiple threads to shared resources. This often leads to major errors. Explain Java Coding Standards for variables?

Answer: 1 Variable names should start with small letters. Ex : string,value,empName,MEP salary. Name three Component subclasses that support painting? To execute the java programs It 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.

Why Java is not a pure Object Oriented language? Answer: Java supports primitive types such as int, byte, short, long, etc that why it is not said to be a pure object-oriented language. What are the access modifiers? Answer: Java provides three access controls such as public, private and protected access modifier. Can we overload the main method?

Answer: Yes, we can overload the main method with syntax as public static void main String args[]. What is the method in java? Answer: It contains the executable body that can be applied to the specific object of the class. The method includes method name, parameters or arguments and return type and a body of executable code.

Separate with commas when we have multiple arguments. Can we use catch statement for checked exceptions? This raises a compile-time error if we try to handle checked exceptions when there is no possibility of causing an exception. Explain a situation where finally block will not be executed? Answer: Finally, the block will not be executed whenever JVM shutdowns. If we use system. Explain about the main method in java?

Answer: The main method is the starting point of execution for all java applications. Every Java application must have at least one main method. What is constructor in java? Answer: A constructor is a special method used to initialize objects in the java. As and when an object is created it is initialized automatically with the help of constructor in java.

We have two types of constructors Default Constructor Parameterized Constructor. How can we find the actual size of an object on the heap? Answer: In Java, there is no way to find out the actual size of an object on the heap. In how many ways we can do synchronization in java?

Answer: There are two ways to do synchronization in java: 1 Synchronized methods 2 Synchronized blocks To do synchronization we use the synchronized keyword. Explain about Automatic type conversion in java? Answer: Java automatic type conversion is done if the following conditions are met: 1 When two types are compatible Ex: int, float int can be assigned directly to float variable. Ex: int, long. Int can be assigned directly to long. Automatic type conversion takes place if int is assigned to long because long is larger datatype than int.

Widening Conversion comes under Automatic type conversion. In how many ways we can do exception handling in java? Answer: We can handle exceptions in either of the two ways : 1 By specifying a try-catch block where we can catch the exception.

What does null mean in java? Example: Employee employee; In the above example employee object is not instantiate so it is pointed nowhere. Can we define a package statement after the import statement in java? We can have commented before the package statement. Explain where variables are created in memory? Answer: When we declare variables are created in the stack. So when the variable is out of scope those variables get garbage collected.

When do we use synchronized blocks and advantages of using synchronized blocks? Answer: If very few lines of code require synchronization then it is recommended to use synchronized blocks. The main advantage of synchronized blocks over synchronized methods is it reduces the waiting time of threads and improves performance of the system.

What is the difference between access specifiers and access modifiers in java? But there is no such division of access specifiers and access modifiers in java. In Java, we have access to modifiers and nonaccess modifiers.

Access Modifiers: public, private, protected, default Non Access Modifiers: abstract, final, strip. What access modifiers can be used for class? Answer: We can use only two access modifiers for class public and default. Explain about abstract classes in java? Answer: Sometimes we may come across a situation where we cannot provide implementation to all the methods in a class.

We want to leave the implementation to a class that extends it. In such a case, we declare a class as abstract.

Top 100 Java Interview Questions and Answers (Download PDF)

Thanks a lot Anonymous for informing us about subtle details about Substring method , I guess Interviewer was looking for that information in his question "How does substring inside String works? Hi Scott, your solution is correct but with the advent of java 5 and now guarantee of volatile keyword and change in Java memory model guarantees that double checking of singleton will work. Hi Anand, Thanks for answering question "How does substring inside String works? Use can use a static holder to handle the singleton creation instead of double checked mechanism. Stored Procedure Error: One way to signal an error is from what is returned.

Home page Contact Us. Net DWH New. Basic Java Interview Question and Answers. What is Java? Java is an object programming language that was designed to be portable across multiple platforms and operating systems.

In this article, we have compiled the most frequently asked Java Interview Questions. These questions will give you an acquaintance with the type of questions that an interviewer might ask you during you interview for Java Programming. As a Fresher, you have either just attended an interview or planning to attend one soon. An Entry Level jobseeker looking to grow your career in software programming , you may be nervous about your upcoming interviews. All of us have those moments of panic where we blank out and might even forget what a thread is. We will simplify it for you, all you need to do it take a deep breath and check the questions that are most likely to be asked.


Dear readers, these Java Interview Questions have been designed especially to get during your interview, normally questions start with some basic concept of and later they continue based on further discussion and what you answer −.


Top Java Interview Questions and Answers for Freshers in 2021

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.

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?

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.

COMMENT 4

  • I was getting a lot of emails and comments to create java interview questions and answers PDF eBook. Julia G. - 29.04.2021 at 10:22
  • Top Java Interview Questions and Answers (Download PDF) In this list of Basic Java interview questions, we have covered all commonly. Aletpabi - 02.05.2021 at 08:45
  • Java Interview Questions i. Java Interview What are the basic interfaces of Java Collections Framework? Both implementations share some common. Daira G. - 06.05.2021 at 23:38
  • Answer: BigDecimal, if memory is not a concern and Performance, is not critical, otherwise double with predefined precision. 2. What is a class in Java? Answer. Sylvia E. - 07.05.2021 at 00:08

LEAVE A COMMENT