Java 2
Java 2
1. Default
2. Public
3. Private
4. Protected
1. Default:-
A class does not have any parameters is called Default
2. Public:-
The public class can be accessible by everyone in the class and it contains
keyword called public
3. Private:-
The private class can not accessible by everyone because it is declared
with in the class and it contains a keyword called private.
4. Protected:-
The class contains a keyword called protected.
Java:-
OOPS Concepts:
1. Class
2. Object
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
1. Class:-
In java a class in nothing but collection of multiple objects and it is a
blue print of an logical entity.
2. Object:-
Object is an instance of class that is used to execute the class.
3. Inheritance:-
Inheritance is nothing but it is deriving a new class from the already
existing class.
4. Polymorphism:-
Polymorphism is a mechanism it performs different things as per objects
and class.
5. Abstraction:-
In java abstraction is nothing but it shows only essential attributes and
hides unnecessary information.
6. Encapsulation:-
Encapsulation is a mechanism it combines the data together and their
function and manipulates under a single unit is called encapsulation.
Constructor:-
String:-
1. String Buffer
2. String Builder
The difference between String buffer and string builder.
Threads:-
Threads can be used to perform complicated tasks in the background
without interrupting the main programme.
Threads can be classified as
Threads
Threads Threads
Threads Implementable- implementable -
Extendable
Runnable Callable
Threads Life Cycle:-
New
Active -
Terminated.
Runnabe;
Time
Blocked
Waiting
Collection Framework:-
1. List
2. Set
3. Map
Hashing Algorithm:-
Hash code:- It will identifies the buckets, for the first time it will assign the
values directly into the buckets.
If same hash code will appears there will be an hash Collision then
equals method must be callable
If it is not equals it will create a new node and assign value into the
node.
In java a class has multiple methods having the same name but different
parameters.
1. No.of parameters
2. Type of parameters
3. Order of parameters
Sorting in java:-
Sorting in java is nothing but it is used to assend the order in size, the
sorting can be defined as
1. Comparator:-
The comparator is used to order the objects of the user defined class
and it is used to compare the two different objects.
2. Comparable:-
Comparable is used to order the objects of the user defined class and it
is used to compare the one object.
Exceptions:-
1. Runtime exceptions
2. Io exceptions
1. Runtime Exceptions:-
The runtime exceptions are also known as un- checked
exceptions these are happen due to programming error
The run time exceptions are also classified into various types they are
1. Arithmetic Exceptions
2. Array index out of bounds of exceptions
3. Null pointer exceptions
2. Io exceptions:-
The Io exceptions are also known as checked exceptions these are
happen due to input and output of the programme, it can be classified into
various types they are
1. File not founds exceptions
2. Eofe
In java if ones an object is created we can not change its content, the class
contains various steps they are
Mutable Class:-
Executor Framework:-
It provides a way to separate the task execution logic the application code.
For creating an executor framework we need to create a thread pool, the thread
pool can be classified into various types they are given below,
Schedule Executor
Package com.exception.java.
Try{
Catch(TestException){
System.out.println(t.getMessage());
}}
Public class TestException extends Exception{
TestException(String str)
Super(Str0) }}}
Class Loader:-
In java the class loaders are part of jvm ad it is used to load classes and
interface.
Java 8 Features:-
Lambda expressions
Functional interface
Method reference
Streams API
Date time API
Optional class
Nashom, and js Engine.
1. Lambda expression:-
The lambda expressions are anonymous functions, it does not
belongs to any class and it does not a any specific name,
2. Functional interface
The functional interface contains only one abstract methods.
3. Method Reference:-
The method reference is a shorthand notation of function using lambda
expression to call a method, it contains various methods that can be
callable
1. Static method reference,
2. Instance method reference of a particular object
3. Instance method reference of a particular type
4. Constructor reference.
5. Streams API:-
The streams Api can be used to process the collection of
objects with the functional style of coding using lambda expression.
Built in functions:-
1. Functional interface
2. Supplier interface
3. Consumer interface
4. Predicate interface
Threads:-
Threads can be used to perform complicated tasks in the background with out
interepting the main programme.
Life cycle of Thread:-
1. New
2. Active – runnable
3. Waiting
4. Blocked
5. Terminated
try
}
catch(TestException)
sout(t.getmessage());
TestException(String str)
super(Str);