CLASS
1.collection of obects is called as classs and it is logical entity
2.class is a group of object which have common properties
OBJECT
1.it is defined as an instance of a class
2.an entity that has state and behavior calles as object
JDK==Java Development Kit
JRE==Java Runtime Environment
JVM==Java Virtual Machine
API==Application programming interface-->predefined function that are ready to use
BUILDIND BLOCKS OF JAVA:
1.object
2.variables
3.methods
4.blocks
Variables are 2 types
1.static, 2.Non-static
TYPE CASTING
conversion of data from one type to another type
2 types of casting
inplicit(widening) and explicit(narrow)
implicit== smaller type to larger type
explicit== larger to smaller
Wrapper classes
convert primitive to object type
Java methods
method is block of code or collection of statement
types of method
1.predefined
2.userdefined
Java Constructors
constructor is a member method which has the same name as class name and never return anything
2types of constructor
1. default 2.parameterized
Constructor Overloading
it is having more than one constructor with different parameter
Static keyword
it is used for constant variable or method that is same for every instance of class
This keyword
this is a reference variable that refers to the object.
Packages
it is group of similar type of classes,interface and sub-packages. it is used to group related classes.
2 types of package
1.user defined package
2.built in packages -->eg: java.utill.array
Access Modifiers
it specifies the accessibility of method, constructors, class.
access modifiers are 1.private 2.package 3.protected 4.public
1.private== within a class
2.package/default == within a package
3.protected== outside the package using extend keyword
4.public == outside the package
OOPs(object oriented principles)
1.Inheritance
Process of defining new object with the help of old objects. extend keywors is used
types
1.single,2.multilevel,3.hierarchial,4.multiple,5.hybrid
Method Overloading
if a class has multiple methods with same name but in different parameter
Method Overriding
child classs having same methos as parent class
Super Keyword
it is reference variable used to refer the immediate parent class object
Final Keyword
cannot be change the values
2.Polymorphism
object of a class behave differently while communicating with diffrent objects. overloading is used
2 types= compiletime,runtime
3.Abstraction
hiding the internal detail of a object
interface will achive complete abstraction
Interface
it is bluebrint of a class and it is static constants and abstacts method and cannot have a body
4.Encapsulation
procees of data together in a single unit. using getters and setters
COLLECTION
The Collection in Java is a framework that provides an architecture to store and manipulate the group of objects.
ArrayList
The ArrayList class implements the List interface. It uses a dynamic array to store the duplicate element of different data types.
Creating arraylist
ArrayList<String> list = new ArrayList<String>();
LinkedList
it uses a doubly linked list internally to store the elements. It can store the duplicate elements.
HashMap
Java HashMap is a hash table based implementation of Map interface.faster
HashSet
HashSet is a Set. It creates a collection that uses a hash table for storage.slow
Hash Code
The hashCode method is an inbuilt method that returns the integer hashed value of the input value
File Handling in Java
File handling in Java implies reading from and writing data to a file. The File class from the java.io package, allows us to work with different formats of files.
Java Annotations
Java Annotation is a tag that represents the metadata i.e. attached with class, interface, methods or fields to indicate some additional information which can be used by java compiler and JVM.
Annotations in Java are used to provide additional information, so it is an alternative option for XML and Java marker interfaces.
Built-In Java Annotations used in Java code
@Override
@SuppressWarnings
@Deprecated
Garbage Collection
Garbage Collection is process of reclaiming the runtime unused memory automatically. In other words, it is a way to destroy the unused objects.
Exception Handling
Exception Handling is a mechanism to handle runtime errors such as ClassNotFoundException, IOException, SQLException, RemoteException, etc
Java Enums
The Enum in Java is a data type which contains a fixed set of constants.
Comments
Post a Comment