Java SE

Ace your homework & exams now with Quizwiz!

Explain Bean in Spring

Beans are objects that form the backbone of a Spring application

What is an anonymous class?

Class defined without a name in a single line of code using new keyword

What is an abstract class?

Class marked with abstract keyword that can have any number of abstract or non abstract methods

Explain Unchecked Exceptions

Classes that extend RuntimeException and They're not checked during compilation time

Explain Checked Exceptions

Classes that extend Throwable class (except Runtime and Error) and they're checked at compilation time

What is a package?

Collection of related classes and interfaces

Explain Hibernate architecture

Configuration Session factory Session Transaction Query Criteria

Main concepts of OOPs in java?

Inheritance Encapsulation Abstraction Polymorphism

State two differences between an inner class and a subclass

Inner classes are in the same file / Subclasses can be in another file Inner classes get the methods they want / Subclasses have methods of their parent class

What is an object in java?

Is a real world entity that has a state an behavior

What is an interface?

Is an improved abstract class that contains a set of abstract methods

What are the functions of JVM ?

JVM provides a runtime environment for Java Byte Codes to be Executed

What do JDK, JRE and JVM stand for?

JVM stands for Java Virtual Machine JRE stands for Java Runtime Environment JDK stands for Java Develpment Kit

What is a JVM?

Java Virtual Machine, which is a runtime environment for compiled Java class files

Classes and Interfaces available in collections

List Set Map Sorted Set Sorted Map Queue ArrayList Vector LinkedList HashSet LinkedHashSet TreeSet HashMap HashTable TreeMap LinkedHashMap

Explain lists available in the Collection

List allows duplicates and its elements are ordered by index position ArrayList Vector (Synchronized) LinkedList (slower than ArrayList)

Explain Map and their types in Collection

Map cares about unique identifier key-value HashMap HashTable TreeMap

What is encapsulation?

Mechanism of wrapping up the data and code together as a single unit

What is abstraction?

Methodology of hiding the implementation details from the user and only providing the functionality to the users

What is Multi-threading?

Multiple threads executed simultaneously

Can a Dead thread be started again?

No

Does java use pointers?

No, Java doesn't use pointers, instead of that, references are used as they are safer

In Spring Scope, explain Singleton

Only one instance of the bean will be created for each container. This is the default scope for the spring beans.

What is the difference between Overloading and Overriding?

Overloading has a different method signature

Can you override a private or static method in java?

Private, no because only elements within the same class have access static, no because instead of inheritance you're hiding the superclass method

What is mean by exception?

Problem that can occur during an execution

What is inheritance?

Process where one class acquires the properties of another

What is Multi-Threading?

Programming concept used to run multiple tasks in a concurrent manner within a single program

What is Object Oriented Programming (OOP)?

Programming model where the programs are organized around objects rather than logic and functions

How do you connect to a database in java?

Registering the driver class Creating connection Creating statement Executing queries Closing connection

Explain Set and their types in Collection

Set don't allow duplications HashSet LinkedHashSet TreeSet

List the different scopes of spring bean

Singleton Prototype Request Session Global-Session

What is a singleton class in Java and how can we make a class singleton?

Singleton class is a class whose only one instance can be crated at any given time, in one JVM A class can be made singleton by making its constructor private

What are access modifiers in java?

Special keywords which are used to restrict the access of class, constructor, variables, etc.

Name the different modules of the Spring framework

Spring Context - dependency injection Spring AOP - oriented programming Spring DAO - database operations using DAO pattern Spring JDBC Spring ORM Spring Web Module Spring MVC

Difference between stack and queue?

Stack is based on LIFO (Last In First Out) and queue is based on FIFO (First In First Out)

Difference between String, StringBuilder and StringBuffer

String is an object immutable StringBuilder and StringBuffer are mutable but StringBuffer is synchronized so is slower than StringBuilder

What is a variable?

attribute that defines the state of a class

Difference between final, finally and finalize

final is an optional specifier that means non-access finally is a code block executed after try/catch blocks finalize works with the Garbage Collector

Link

https://www.edureka.co/blog/interview-questions/java-interview-questions/#java-platform-independent

Most important feature of java:

is a platform independent language

What's the Base class of all exception classes?

java.lang.Throwable

What are the life-cycle of methods for a jsp?

jspInit - invoked only once, same as init() of servlet _jspService - invoked at each request jspDestroy - invoked only once, same as detroy() of servlet

What is polymorphism?

property of an object to take on many different forms

Difference between start() and run() in thread class?

start() creates new thread and the code inside run() is executed in the new thread

What's the difference between this() and super() in java?

this() is used to call a constructor of the same class super() is used to call a constructor of the parent class

How you can handle java exceptions?

try catch finally throw throws

What are constructors in java?

Block of code used to initialize an object

What are the types of Exceptions?

Checked Exceptions Unchecked Exceptions

Define CLASS in Java

Container of all java codes, includes variables and methods

What is a method?

Contains a set of statements or instructions to satisfy a particular requirement

What is meant by Serialization?

Converting a file into a byte stream

What are the different tags provided in JSTL?

Core tags SQL Tags XML Tags Internationalization tags Functions tags

What are the types of constructor?

Default constructor (no parameters) Parameterized constructor (has parameters)

What is autowiring in spring?

Enables the programmer to inject the bean automatically

What's the difference between equals and ==?

Equals is used to compare two objects == is used to compare primitives and objects

Difference between Error and Exception

Error is an irrecoverable condition during runtime Exceptions are conditions that occur because of bad input, human error, etc. And is possible to recover from it

How do you make a thread in java?

Exted Thread class Implement runnable interface

What are Collections in Java?

Framework used for search, sort, manipulate, insert and delete a set of objects

What is java string pool?

Heap memory space that collects a set of string literals

What is java?

High-level programming language and platform independent

What are the functions of JRE?

Includes sets of files required by JVM during runtime

In Srpint, explain the role of ContextLoaderListener

Listener to start up and shut down the WebApplicationContext in Spring root. An important function is tying up the lifecycle of Application Context to the lifecycle of the ServletContext and automating the creation of ApplicationContext

What is synchronization?

Makes only one thread to access a block of code at a time

What is the disadvantage of Synchronization?

Makes slow performance because threads have to wait until the code is enable

What are the features in Java?

OOPs concepts: *Object O

What is Hibernate Framework?

Object-relational mapping (ORM) for mapping application domain objects to the relational databse tables and vice versa

Explain garbage collection in java

When an object is no longer in use or referenced, garbage collection is called and the object is destroyed

What are wrapper classes in java?

Wrapper classes convert the Java primitives into objects. Are wrapper classes because they wrap the primitive data type

Which are the access modifiers?

private default package private protected public

In Spring Scope, explain Global-Session

Used to create global session beans for Portlet applications

How to stop a thread in java?

Using the following methods: sleeping waiting blocked

What are some of the important Spring annotations which you have used?

@Controller @RequestMapping @ResponseBody @PathVariable @Autowired

List some of the important annotations in annotation-based spring configuration

@Required @Autowired @Qualifier @Resource @PostConstruct @PreDestroy

Difference between ArrayList and Vector in java?

*ArrayList is not sychronized (Vector is) *ArrayList is faster as it's not synchornized (Vector slower) *ArrayList doesn't define the increment size (Vector does) *ArrayList can only use Iterator (Vector can use Enumeration and Iterator)

Difference between abstract class and interface?

*Type of methods *Type of variables *Method implementation *Inheritance vs abstraction *Multiple implementation *Abstract keyword

What is spring?

A lightweight, integrated framework that can be used for developing enterprise applications

In Spring Scope, explain Session

A new bean will be created for each HTTP session by the container

In Spring Scope, explain Request

A new instance of the bean will be created for each HTTP request

In Spring Scope, explain Protptype

A new instance will be created every time the bean is requested

What is FINAL keyword in java?

A non-access specifier that can be used in: variable, method, class

What is a thread?

The flow of an execution

In Spring, explain the role of DispatcherServlet

The front controller in Spring MVC application, loads the spring bean configuration file and initializes all the beans that have been configured. Also scans the packages to configure any bean annotated with @Component, @Controller, @Repository or @Service


Related study sets

despite, inspite of, although, though

View Set

AP World Chapter 17 - Nomadic Empires And Eurasian Integration

View Set

U.S. History Final Exam: Module 13

View Set

Psychology Chapters 1-6 Study Questions

View Set

Pediatric Musculoskeletal Disorders

View Set

Chapter 05: Cochlear Physiology Quiz

View Set

Med Surg TEST 5 Practice Questions

View Set