Docsity

Basic Java Interview Questions and Answers, Schemes and Mind Maps of Computer science

Toggle sidebar
bg1
BASIC INTERVIEW QUESTIONS IN JAVA
What is the difference between an Applet and a Java Application?
ļ‚·Applets are executed within a Java-enabled browser.
ļ‚·Java application is a standalone Java program that can be executed outside of a
browser.
However, they both require the existence of a Java Virtual Machine (JVM). Furthermore, a
Java application requires a main method with a specific signature, in order to start its
execution. Java applets don’t need such a method to start their execution. Finally, Java applets
typically use a restrictive security policy, while Java applications usually use more relaxed
security policies.
What are the two types of Exceptions in Java? Which are the differences between them?
Java has two types of exceptions: checked exceptions and unchecked exceptions.
1. Unchecked exceptionsī˜do not need to be declared in a method or a constructor’s
throws clause if they can be thrown by the execution of the method or the constructor,
and propagate outside the method or constructor boundary.
2. On the other hand,*checked exceptions*must be declared in a method or a
constructor’s throws clause.
What is a Servlet?
The servlet is a Java programming language class used to process client requests and generate
dynamic web content.
Servlets are mostly used to process or store data submitted by an HTML form, provide
dynamic content and manage state information that does not exist in the stateless HTTP
protocol.
What is the Difference between JDK and JRE?
ļ‚·The Java Runtime Environment (JRE)ī˜is basically the Java Virtual Machine
(JVM) where your Java programs are being executed. It also includes browser
plugins for applet execution.
ļ‚·The Java Development Kit (JDK)*is the full-featured Software Development Kit for
Java, including the JRE, the compilers, and tools (like JavaDoc, and Java Debugger),
in order for a user to develop, compile and execute Java applications.
What is JVM? Why is Java called the "Platform Independent Programming
Languageā€?
pf3

Partial preview of the text

Download Basic Java Interview Questions and Answers and more Schemes and Mind Maps Computer science in PDF only on Docsity!

BASIC INTERVIEW QUESTIONS IN JAVA

What is the difference between an Applet and a Java Application? ļ‚· Applets are executed within a Java-enabled browser. ļ‚· Java application is a standalone Java program that can be executed outside of a browser. However, they both require the existence of a Java Virtual Machine (JVM). Furthermore, a Java application requires a main method with a specific signature, in order to start its execution. Java applets don’t need such a method to start their execution. Finally, Java applets typically use a restrictive security policy, while Java applications usually use more relaxed security policies. What are the two types of Exceptions in Java? Which are the differences between them? Java has two types of exceptions: checked exceptions and unchecked exceptions.

  1. Unchecked exceptions do not need to be declared in a method or a constructor’s throws clause if they can be thrown by the execution of the method or the constructor, and propagate outside the method or constructor boundary.
  2. On the other hand, checked exceptions must be declared in a method or a constructor’s throws clause. What is a Servlet? The servlet is a Java programming language class used to process client requests and generate dynamic web content. Servlets are mostly used to process or store data submitted by an HTML form, provide dynamic content and manage state information that does not exist in the stateless HTTP protocol. What is the Difference between JDK and JRE? ļ‚· The Java Runtime Environment (JRE) is basically the Java Virtual Machine ( JVM ) where your Java programs are being executed. It also includes browser plugins for applet execution. ļ‚· The Java Development Kit (JDK) is the full-featured Software Development Kit for Java, including the JRE, the compilers, and tools (like JavaDoc, and Java Debugger), in order for a user to develop, compile and execute Java applications. What is JVM? Why is Java called the "Platform Independent Programming Languageā€?

A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform. What is a JSP Page? A Java Server Page (JSP) is a text document that contains two types of text: ļ‚· static data and ļ‚· JSP elements. Static data can be expressed in any text-based format, such as HTML or XML. JSP is a technology that mixes static content with dynamically-generated content. What are the features of Java? ļ‚· Object-oriented programming (OOP) concepts ļ‚· Platform independent ļ‚· High performance ļ‚· Multi-threaded What are the OOP concepts? ļ‚· Inheritance ļ‚· Encapsulation ļ‚· Polymorphism ļ‚· Abstraction ļ‚· Interface What is data encapsulation, and why is it useful? Encapsulation is a concept in Object-Oriented Programming for combining properties and methods in a single unit. Encapsulation helps developers follow a modular approach for software development because each object has its own set of methods and variables and serves its functions independent of other objects. In addition to that, encapsulation serves data hiding purposes. What is polymorphism? Polymorphism is one interface with many implementations. This characteristic allows you to assign a different meaning or usage to something in different contexts. For example, you can