Java is also called platform independent due to the byte codes that can be easily run on any operating system.
Java makes the use of 8 primitive data types which include char, Boolean, int, float, byte and short which do not come in object category that is why java is not 100% object-oriented programming language.
JVM stands for Java Virtual Machine. JVM is an interpreter which accepts and executes the ‘Bytecode’
Main features of the Java include Robust, Object Oriented, Multi-threaded, Platform Independent and Interpreted.
Java is designed for adopting to a changing environment. Its programs carry large amount of information which can be very useful in resolving and verifying entrees to an object on the run-time.
In the java, a class consists methods and fields for defining the nature of an object. It is a blue print which is responsible to create the objects.
Java was released and developed by Sun Microsystems in 1995. It ia high level and object-oriented programming languages which can run on numerous platforms, which include Mac OS, Windows, and many more.
Java Architectural Neutral is a compiler which is used for generating an architecture-neutral object file format. With the java runtime system presence, its covert compiled code to executable form.
Java runs of Mac OS, Windows and also on many versions of UNIX/Linux such as CentOS, Redhat Linux, Sun Solaris, HP-Unix, Ubuntu, etc.
The 5 Java IDE’s are listed below:
Some keywords of Java are listed below:
If you want to create an object for a class then you need to follow these steps:
• Declare the object
0 is the default value of byte datatype in Java programming language.
The default value of float datatype in Java programming language is 0.0f.
The default value of double datatype in java programming language is 0.0d.
For enabling high performance, time compiler is used by Java which is used for converting the instructions into bytecodes.
A class is knowns as user defined prototype and blueprint by which objects are formed. It signifies the set of methods or properties that are same for all the objects.
We apply parseInt() method For getting the primitive data type of a particular String.
java.util.regex have three classes which are listed below:
1. Pattern class
2. Matcher class
3. PatternSyntaxException class
An issue which occurs at the time of exacting a program is known as Execution. These are caught by supervisors placed with the thread’s technique.
Exception class consists of two major subclasses which are as follow:
• IOException class
• RuntimeException Class
Singleton class regulates the creation of the object, limits the number to 1 but permits the flexibility for creating objects if any condition changes.
The full form of JDK is Java Development Kit. JDK is a tool essential to package, document and compile Java programs.
JRI is the short for Java Runtime Environment. It refers to a runtime environment which is responsible for executing Java bytecode.
The full form of JVM is stands for Java Virtual Machine. Three notations are followed by JVM: Runtime Instance Specification and Implementation
The advantages of Packages are listed below:
• Assist to avoid the name clashes.
• Deliver simpler access control on the code
• Have hidden classes which only used in the packages and not observable to outer classes
• Helps in creating a suitable hierarchical structure.
Basically 4 types of access modifiers are supported by java:
There ae two types of constructors:
• Default Constructor
• Parameterized Constructor
Default constructors are also known as the no argument constructors that can be made by default and does not take any participations.
In java, Parameterized Constructor is the one that takes the argument and they are able to initialize the instance variables with the provided value.
• Array List is not coordinated.
• It is fast
• It does not describe the increment size.
• Iterator is used by array list to traverse an Array List.
• Vector is coordinated.
• Vector is a thread safe so it is slow.
• It defaults to maximizing the size of its array.
• Increment size is defined by vector
An object has 3 characteristics which are listed below:
We create an object by using the ‘new’ keyword. For instance:
ClassName obj = new ClassName();
The main concepts of OOPs in Java are:
Final is a special keyword in Java which is basically act as a non-access modifier. We can use this variable in various contexts which includes:
• final variable
• final method
• final class
We can achieve Constructor chaining by two ways:
• From base class using super()
• Within the same class using this()
A subset of Java Virtual Machine (JVM) which is used to load the class files is known as Java ClassLoader.
Three built-in classloaders are provided by java
• Extension ClassLoader
• Bootstrap ClassLoader
• System/Application ClassLoader
The characteristics of Map interface are:
• Map doesn’t comprise duplicate keys.
• Each and every single key can map at maximum one value.
• Parent class which is a Super or Base class.
• Child class which is a Subclass or Derived class.
When one class gets the features of another class then this is known as single inheritance.
In Multilevel Inheritance, when one class is derived from other class and that other class has also been derived from another class.
Hierarchical Inheritance means a class having more than one subclasses (child classes)
A mixture of two or more types of inheritance is known as Hybrid inheritance
We can achieve encapsulation by two simple ways:
• Stating the variables of a class as a private.
• Offering getter methods and public setter for changing and viewing variables values.
Listed below are the five stages in the servlet lifecycle:
• Servlet is destroyed
• Servlet is initialized
• Servlet is loaded
• Service the request
• Servlet is instantiated
• Session Management API
• User Authentication
• URL Rewriting
• HTML Hidden Field
The types of JDBC drivers are:
• Thin driver (fully java driver)
• JDBC-ODBC bridge driver
• Native-API driver (partially java driver)
• Network Protocol driver (fully java driver)
The methods for connecting to a database in java are:
• Creating statement
• Executing queries
• Registering the driver class
• Creating connection
• Closing connection
Three types of statements are supported by JDBC
The different modules of the spring framework are:
• Spring DAO
• Spring JDBC
• Spring ORM
• Spring Context
• Spring Web Module
• Spring AOP
• Spring MVC
5 Types of Scopes defined in Spring beans are as follows:
Important Spring annotations are:
There are 2 types of transaction management which spring support:
• Programmatic transaction management
• Declarative transaction management
By using these 5 keywords we can handle the Java exceptions
The important methods of Java Exception Class are as follows:
• Synchronized Throwable getCause()
• String getMessage()
• void printStackTrace()
• String getLocalizedMessage()
• String toString()
Java provides 4 types of garbage:
• CMS Garbage Collector
• Serial Garbage Collector
• Parallel Garbage Collector
• G1 Garbage Collector
The two ways to create a thread are:
• Implement the Runnable interface.
• Extend the Thread
Subclass of java.lang.Error which usually happens when our Java Virtual Machine runs out of memory is known as OutOfMemoryError in Java.
• Native Method Stack
• Program Counter Register
• Class(Method) Area
No, we cannot make a constructor final
• By using the constructor
• Assign the values of one object into the another object
• By using the clone() method of Object class
There are five types of Inheritance in Java:
• Multiple Inheritance
• Hybrid Inheritance
• Single-level inheritance
• Hierarchical Inheritance
• Multi-level inheritance
The superclass for all the classes is the Object class.
The main uses of the super keyword are:
• Invoking the immediate parent class method.
• Invoking immediate parent class constructor.
Method overloading can be achieved by two ways:
• By modifying the number of arguments
• By modifying the return type
No, as it is limited to the class so we can not override the private method.
Yes, all the functions are virtual by default in java
Typecasting is of two types: