Java Documentation (AutoRecovered)
Java Documentation (AutoRecovered)
------------------------11/9/2023-Monday-------------------------------------
Java is platform independent
Java has 51 or 52 key words
Programs
Area of square
Area of rectangle
Area of circle
------------------------12/09/2023-Tuesday--------------------------------------
Addition of 2 nosfyg
Sub of 2 nos
Mul of 2 nos
Div of 2 nos
Power bill
Shopping bill
----------------------------13/09/2023-Wednesday-------------------------
Datatypes
Byte
Short
Int
Long
Float
Double
Boolean
Char
Submission form—just datatypes
Power bill-just datatypes
--------------------------------14/09/2023-Thursday------------------------
How to create new java project in spring tool
How to create class
---------------------------15/09/2023-Friday------------------------------
Execution starts from main method
In java it reads line by line
Programs
Area of square, rec, circle, triangle
-----------------------------16/09/2023-Saturday--------------------------------
Variable decalartion;
Variable initialization;
//17-sun-h
//18-mon(vin)-h
//19-tue(vin)-h
-----------------------------20/09/2023-Wednesday------------------------------
Datatypes
Int -8 bit
Byte-16
Short-32
Long-64
Float-32
Double-64
Boolean-1
Char-16
-------------------------------------21/9/2023-Thursday--------------------------
Keywords
Datatypes
Byte – 8 bits
Short -16 bits
Int – 32 bits
Long – 64 bits
Float – 32 bits
Double – 64 bits
Boolean – 1bit
Char c = ‘n’;
Char n = 67;
16 bytes
Single quotatations means no ascii
-------------------------------
Int x = 34;--right
X = 34;---wrong
-------------------------------------
Byte age;---var declaration
Age = 23---right
Byte age = 23;--wrong
Byte age1 = 34;
//var inti
(0r)
Byte age = 12;//var int
-----------------------------22/09/2023-Friday---------------------------------
Programming
Datatypes is 2 types
Primitive -
-------------------23/09/2023-Saturday-------------------------------------------
2 programs
Datatypes capability is it can store some values it has no conditions
------------------25/09/2023-Monday-------------------------------------------
Flow controls:
If---syntax
Else -if
If/else
Switch
Break
Default
For
While
Do while
Operators
---------------------------------26/09/2023-Tuesday-----------------------------
package com.slokam;
public static void main(String[] args) {//Execution starts from main method
int marks;
//marks = 34;
//marks = 36;
//marks =50;
//marks = 70;
marks = 90; int = 32 bit
if (marks<=35) {
System.out.println("Fail");
}
if (marks>=36&&marks<50) {
System.out.println("Pass");
}
if (marks>=50&&marks<70) {
System.out.println("second class");
}
if (marks>=70&&marks<90) {
System.out.println("First class");
}
if (marks>=90&&marks<=100) {
System.out.println("Distinction");
}
When we run a program the JVM calls main method execution starts from here
here in above program at first we declared the variable and initialized the
variable. We have taken int datatype for variable so it creates 32 bit data(it
allocates 32 bit memory).our value is stored in that 32 bit. Now it checks series of
if statements I have initialized marks = 90. Here it will check all the if statements
which if statement is true it will print in the console.
Else if stops the execution when the condition is true it will not check all the
conditions as if statement.
----------------------------------27/09/2023-Wednesday----------------------------
SEP1234
--------------------------------28/09/2023-Thursday------------------------------
If
If else
If if if
If { if{else if()
35567.567 double
Ro = true
Bus a= true;
Seats = true;
Tickets = true;
Paymet = true;
-------------------------------------29/09/2023-Friday-------------------------
Switch
If
If else
If
If else else break default switch
1) Switch test
-----------------------------------30/09/2023-Saturday---------------
Today 2 programs
1.Restuarant.java
2.Smarks.java
-----------------1/09/2023—Sunday-------
--------------------------------2/09/2023-Monday-----------------------
--------------------------3/09/2023-Tuesday---------------------------
Heap memory
Gmail example, Facebook example, owner only creates one class and we are
objects
Package emp&student
Stu.java new program just different appoarch
-------------------------04/10/2023-Wednesday--------------------------
-----------------------05/09/2023-Thursday------------------------
}
Main()
{
}
}
Main
First object creation for class
Then it contains all instance variables and instance methods
From this you can call all the instance variables and instance methods from main
method
Method call
Method execute
--------------------------06/09/2023-Friday----------------------------
L,b
Rect = 2*l+b
Area
Square = a*a;
Calculatordynamic.java
CalculatorParameters.java
Areasbymethods.java
----------------------------------07/10/2023-Saturday------------------
}
Classname ref.methodname();
package microsoft;
3 programs
} 1.sbill.java
} 2.test.java
3.Circle.java
Void – return type
---------------------------11/10/2023-Wednesday-------------------------
Hibernate
Spring boot
Microservices
Project
AWS
MySQL
logical programs
1.8 features
Interview questions
Byte b =12;
Byte[] n ={12,34,56,78}
N[2]=100;
Sop(n[0]);//no extra
Sop(nam[0]);
1)DatatypesRange.java
2)smarks.java
3)sdetails.java
-----------------------------13/10/2023-Friday--------------------------
If(t){
}
Selective – if, switch – condition checked only once
For (){
} conition true ayinata sepu it will iterate
//I =1 t i+1
//i=2 t i+1
//i=9 t i+1
//i=10 t i+1
//i
//initia //condi
For(int I =1; i<10; i=i+1){
Sop(i)//1…9
}
Int k =1
If(k<=5){
Sop(k)
-------------------------------------14/10/2023-Saturday----------------
Int t=0;//34;90;168;287;347;439
{
For(int i=0;i<=marks.length-1;i=i+1)
{
Tmarks =tmarks+marks[i];
}
Sop(tmarkks)
Sop(tmarks/6) per
If(marks[i]>=35)
{sop(pass+marks[i]);
}
Else{
Sop(fail);
}
}
Clock
I want timeh-24,m-60,s-60
I want tables
public class Hi {
If()
Elseif()
Nestedif /Nestedelse
Switch
Nested switch
Case
Break
Default
Looping statements
For()
{}
While()
{}
Dowhile()
{}
OVER ALL COVERED TOPICS
Datatypes
Flow contols
Object
Class
Methods
Arrays
---------------------------------------------17/10/2023-
TUESDAY-------------------------------------------------------------
Topic: Methods different ways usage
Project: Methods with dif types
Package: com.slokam
Programs:1)Slkstd.java
2)test.java
3)Student.java
How to use methods in different ways
Way 1:Normal instance method without any parameters
void m1()
{
System.out.println("Normal instance Method");
System.out.println("Returntype it is not going to return anything to
the calling method");
System.out.println("Method call without any parameters");
}
Way 2:Normal instance method with parameters datatypes (only single
values can be taken){byte,short,int,long,float,double,char,Boolean,String}
Way 4:Normal instance method with method call parameter can be class
instance/object
void m4(Student std)
{
System.out.println(std.sid);
System.out.println(std.sname);
System.out.println("Student Marks Address: "+std.marks);
for(int i=0;i<std.marks.length;i++)
{
System.out.println("Marks Obtained: "+std.marks[i]);
}
System.out.println("Subjects Address: "+std.subj);
for(int i=0;i<std.marks.length;i++)
{
System.out.println("Subjects: "+std.subj[i]);
}
System.out.println("Normal instance method");
System.out.println("returntype it was not returning anything to calling
method");
System.out.println("Method Call Parameter can be class
instance/Object also");
----------------------------18/10/2023-WEDNESDAY------------------------
void addemployee() {
System.out.println("Method Executed"+"\n");
System.out.println(emp[0].eid);
System.out.println(emp[0].ename);
System.out.println(emp[0].esal);
System.out.println(emp[0].edesig+"\n");
System.out.println(emp[1].eid);
System.out.println(emp[1].ename);
System.out.println(emp[1].esal);
System.out.println(emp[1].edesig+"\n");
System.out.println(emp[2].eid);
System.out.println(emp[2].ename);
System.out.println(emp[2].esal);
System.out.println(emp[2].edesig+"\n");
}
JVM
void getallemployees(Employee emp[]) {
}
}
Heap Memory
}
Today Class Summary
*if you see this method create single employee object and initialize and pass or
send it.
Void addallemp(employee[] e)
{
*we need create many emp objects and we need to store all this in one one array
and send or pass it
Employee m1()
{}
Employee[] m2()
{}
Int m3()
{
Return 3;
}
Int[] m3()
{
Int[] n ={12,23}
Return n;
}
-------------------------------------------------19/10/2023—Thursday----------------------
OOPS CONCEPTS:
Public: By using public access modifier we can use within class,outside class,
within package , outside package by import
Structure
Public default final abstract interface extends class name siva
{
Public default private protected final static transient volatile var =13
---------------------------25/10/2023-Wednesday----------------------------------------
Topic: one to one and one to many Relations
Project: OOPS CONCEPTS
Package: com.relations AADHAR and mobile
Programs:
-------AADHAR CARD----------
1.Person.java
2.Adhar.java
3.Mobile.java
4.test.java
--------PAN CARD------
5.Panper.java
6.Pancard.java
7.Car.java
8.PTest.java
------------------------------------------------26/10/2023—Thursday-----------------------
Topic: About Instance variable, Instance Method, Instance block
Static variable, Static Method, Static block
Program Phases: Compilation & Running
Project: OOPS Concepts
Package: com.wipro
Programs:
1.one.java
2.Two.java
Java comes in 2 stages
-------------------------------------------27/10/2023-Friday---------------------------------
Class{
Ins/sta Var
Ins/sta methods
Ins/sta blocks
}
--------------------------------------------28/10/2023-Saturday-----------------------------
Class
Object
Methods
Instance and static
Access modifiers
Encapsulation
How to initialize object using setter methods
Static
------------------------------up to here completed-------------------------------------------
Constructor
Innheritance
Interface
Abstract
Overloading
Overriding
--------------oops concepts will be completed---------------
Files
Exception handling
Threads
Object class methods
collections
Constructor :N
--------------------------30/10/2023-Monday------------------------------------------------
Topic:Constructor
Project:Constructor
Package:co.vyaire,com.RelationslikeAADHAR and MOBILE, com.Tuesday
Programs:1)emp.java,2)test.java,3)Person.java,4)AADHAR.java,5)Mobile.ja
va,6)PTest.java,7)Student.java,8)STest.java
--------------------------------31/10/2023-Tuesday-----------------------------------------
Topic:Setter and Constructor Initialization
Project: Constructor
Packages:com.Tuesday,com.RelationslikeAADHAR and MOBILE
Programs:1)Person.java, 2)Adhar.java, 3)Mobile.java, 4)PTest.java,
5)Student.java, 6)pancard.java, 7)Address.java, 8)PTest.java
-----------------------------------------01/11/2023-------------------------------------------
Topic:Inheritance, Five types of Inheritance but we use three
Projects:Inheritance
Packages:Singlelevel_Inheritance, Multilevel_Inheritance, Hierarchical
_Inheritance
Programs:schild.java,sparent.java,STest.java
2)Multilevel
3)Hierarchical
4)Multiple
5)Hybrid
------------------------------------------02/11/2023-Thursday------------------------------
Topic: Hierarchical inheritance
Project: Inheritance
Package: Hierarchical Inheritance
Programs:
1)Login.java
2)Clerk.java
3)Manager.java
4)Test.java
Login
Customer
Clerk reg() Manager reg() reg()
---------------------------------------03/11/2023-Friday------------------------------
Multi level Inheritance
Project: Inheritance
Child, Parent, grandparent, Test
------------------------------04/11/2023-Saturday-------------------------------------------
Topic: Overloading and Overriding
Project: Overloading,Overriding
Packages: com.CompiletimePolymorphismandStaticPolymorphism,
com.RuntimeorDynamic Polymorphism,com.FinalKeyword
Programs:
1)Login.java,2)Register.java,3)child.java4)parent.java,5)Fchild.java,6)Fparent.jav
a
-------------------------------------06/11/2023-Monday-------------------------------------
Topic:
Project:
Package:
Programs:
Overload
Override
Final
Public
Default lo
Private lo
Protected
Access modifers,static,final can be overloaded
Returntypes
No need to be same
--------------------------------08/11/2023-Wednes day------------------------------------
Topic:Interface, Purpose of Interface, Limitations, Restrictions for variables,
methods and blocks in Interface.
We cannot create the object in interface
Project:INTERFACE
Package: com.testinterface, com.SlokamLoan
Programs:1)Siva.java(Interface)
2)Test.java(Class)
3)Loan.java(Interface)
4)CarLoan.java(Class)
5)HouseLoan.java(Class)
6)LTest.java(Class)
-----------------------09/11/2023-Thurday---------------------------------------------------
Topic: Interface, Multiple Inheritance is achieved by interface, Protected Access
Modifier
Project: Inheritance, Protected_Access_Modifier
Package: Multiple Inheritance,com.protect,com.protectess
Programs:
1) A.java(interface)
2) B.java(interface)
3)C.java(Class)
4)one.java(Class)
5)two.java(Class)
6)Three.java(Class)
---------------------------10/11/2023-Friday----------------------------------------------
Topic:
Project:
Package:
Programs:
-----------------------------------13/11/2023-Monday---------------------------------------
Topic:
Project: File Creation, Deletion, Diff types of file methods usage
Package: com.cisco, com.readdata, com.writedata
Programs:
1) Filecreation.java
2)Filediffmethods.java
3)FindHowmanyFieldsInFolder.java
4)Finding_Files_inside_Directory.java—not completed
5)Wdata.java
6)Rdata.java
7)Rbuffer.java
Sep one
Pack: com. cisco
Slokam.java
Exists
If not
--------------------------------14/11/2023-Tuesday------------------------------------------
Topic: String Class
Project: String Class
Packages: com.pojo, com.read
Programs:
1) one.java
2)two.java
3)Three.java
4)Readdata.java
String class
String literals—String s1=”siva”;
Split
For file editing
----------------------------15/11/2023—Wednesday----------------------------------------
Topic:
Project: Read data
Package: com.controller, com.pojo
Programs:
1)employee.java
2)FileDao.java
3)Test.java
Commonfile-empdataone
Pojo class exists means data should be taken from file and given to pojo class.
The data in pojo class must be given to file.
The data in file must come to pojo class
The data in pojo class must go to file
This is mediator, we must ply the object
Create another packsge
Class== FILEDAO
Public class FileDao{
//I want methods like they must read data from file line by line ,the read data must
be set in to pojo class this is our 1st task
//I need to fetch id
Public employee void getbyId(int eid){
Employee emp=new employee();
Return emp;
}
Public employee[] getByName(String ename){
}//This Array will take multiple employee objects
But array have some disadvantages
Disadvantages:
Employee[] emp={b,t};
Employee array means it will take only employee class objects
Employee array will not take the test class object t.
Int array means it will take only int values
Usedefined classes means it will take only userdefined objects only
The array which type it will take that kind of data only
The above is main disadvantage of the arrays
If I want different kinds of data then how?
Arrays>datatypes
1)contains length method
2)Takes multiple values
Now I want the multiple methods not only length, and I should take different
types of data
From collection topics I am taking ArrayList
ArrayList is a class which implements arrays which in util package
We can add any kind of data
Import java.util.ArrayList;
Import com.pojo.employee;
Public class test{
Public static void main(String[] args){
Employee e1 = new employee(104,”siva”,34,6567.89,”se”);
Employee e2= new employee(105,”ram”,34,6567.89,”se”);
Array we can implement same kind of data. But in array list we can implement
different kind of data. Internally Arraylist also implements array only.
I n Array only length method. But In Array list I have so many methods.
Arraylist is replacement for arrays .Arraylist has so many builtin methods
support.
Get all means we will have multiple objects right. So take Array List
<>-generic (for specification of data)
When you said I want to insert only employee data this generic is neede. If you
did not say that specific data. You can insert anykind of data. Noneed of generic.
ArrayList<employee> k = new ArrayList<>();
ArrayList<String> k = new ArrayList<>();
Here you said we can take only string data
Then I got a doubt that what is difference between simple string array and the
Arraylist
Differences
In arrays only length method is there in Arraylist there are somany methods.
Exception Handling
1)Types of Exception
2)What is Exception
3)What is Error
4)Try/Catch
5)Throw/Throws
6)Finally
7)Custom exception.
Example:
Road bike person
When a person want to take a bike he checks whether he has keys or not. Next
we will check for petrol, air in tires.
When Iam about to start even I did not started I got some exceptions. These
exceptions are called checked exceptions or compile time exceptions.
Air ,PETROL,KEYS are complietime exceptions
In our program the compile time exceptions are called Checked Exceptions.
These Checked exceptions must be handled then only program compiles.
Which third party, or connecting with something of others these are checked
exceptions
Example: I tried to connect a file. That file may present or not that is called
checked exception.
Now I need to run the program. I need to start the bike and I need to come from
Starting point to end point these need to be done at the ruuning or run time.
Now everything looks fine but when the program runs/Bike runs accident can
happen, friend can call, Police may stop
Puncture can happen
The above exceptions are runtime exceptions/Unchecked Exceptions.
Example:
Now we will see some run time exceptions below
package com.BasicExceptions;
In above example when we say n[0] in compile time it will not check it ther e any
data at n[0] or not . It will not even check is there zeroth index or not
also .Because For the Above mentioned string data creates at runtime.In compile
time it will not check n[0],n[1],n[2] is present or not. Which programs runs string
array object creates into that array data wiLG-L be inserted in to 0th index and 1wt
index.
(or)
When program execution starts for n array creates.After creation of array data
inserted in to the 0th and 1st index.
In compiletime it will not check the indexes. This indexes are checked runtime.
Ex:String n= {"siva","ram"};(wrong)
In compiletime it will only check either it is array or not& in this array it will
check have you given syntactically correct data or not
Ex:String[] n= {"siva","ram",097};(wrong)
Ex:String[] n= {"siva","ram",097};(wrong)
If another line added to above program
package com.BasicExceptions;
String[] n= {"siva","ram"};
System.out.println(n[0]);
System.out.println(n[1]);
System.out.println(n[2]);
OUTPUT:
Siva, ram,ArrayIndexoutofboundexception(Runtime Exception)
String[] n= {"siva","ram"};
System.out.println(n[2]);
System.out.println(n[1]);
System.out.println(n[0]);
}
When an exception comes at top remaining bottom lines will not excute
OUTPUT:
ArrayIndexoutofboundexception(Runtime Exception)
package com.BasicExceptions;
String[] n= {"siva","ram"};
System.out.println(n[0]);
System.out.println(n[1]);
System.out.println(10/0);
System.out.println(n[2]);
System.out.println(n[3]);
}
--------------------------16/11/2023-Thursday-----------------------------------------------
2 SUB CLASSES
1)ERROR(sub classes)
2)Exception(sub classes)
https://interviewnoodle.com/exception-in-java-89a0b41e0c45
Errors are unchecked errors occur at runtime
All child class of error class are unchecked errors occur at runtime
It is like hierearchical inheritance
8-15
Lack of memory resources error will come not becoz of our code
M1()
sts
M2();
END
M2()
S
e
g.m1();15-19
STACKS compile&update
When you goes to back to jvm normal termination of stack happens
M2
10/0
Abnormal termination
Try{
10/0
hello}
Catch
Or handle at m1()
M2()
M1(); recursive call
Or handle at main method
47-50
Patrt2 3-7
8-
T class
Err
Exe
Rte
Npe
Two
19-23-definations
Multiple catch purpose
Afternoon
Final can be applicable
Finally{} block
Try{}catch
Try{}catch(c)/catch(p)
Try{}finally{}-----**try exception or not it comes to finally
Try{}catch/finally{}
Try{}catch/catch/finally{}
Irrespective of exception finally
What is Exception?
Error?
Types of Exceptions?
Exception hierarchy
What happened when exception has been raised
5 ex for checked exceptions
5 ex for unchecked exceptions
Try/catch
Finally
Throw
Throws
User defined exceptions
Try with resources
Throw -jvm thrown
Own application own exception classes behave
AFTERNOON
THROW IS USED FOR CRETION OF EXCEPTION OBJECT.
Only classes in exception hierarchy they can be thrown
To be in exeption -----
Vyaire extends runtime exception
ATM PROGRAM
-----------------------------18/11/2023-saturday--------------------------------
Throw-userdefined exceptions define
Arithmetic excep
Nullpointer
----------------------------20/11/2023-Monday---------------------------------------------
Topic:Threads
Project:Threads
Packages:com.displayingThreadName,CreatingThreads
--------------22/11/2023-WED------------------------------------------------------
Topic: Synchronized
Project: Threads, Synchronized_Keyword
Packages:Multiple_Thread_Displaying_Singletime,New, Movie_Ticket_Booking
Programs:1) Ticketbooking.java
2)User.java
3) Bank.java(1st program)
4)BankCls.java
5)Customer.java
6)BankWD.java
7)Bank.java(Switch)
8)Transactions.java(Switch)
Siva is a child of thread .Thread is a chlid of Runnable.
--------------------------------------23/11/2023-----------------------------------------------
Topic: Synchronization, Thread lifecycle, Object level lock, Class Level lock
Project:Synchronized_Keyword
AFTERNOON
Package:Synchronize, Synchronized_Block
(AFTERNOON)
Programs:
1) Bank.java
2) Slokam.java
3) Bank1.java
4) Slokam1.java
Afternoon
1)one.java
-------------------------------------------24/11/2023-Friday-------------------------------
----------------------------------25/11/2023----------------------------------------
Topic: Cloning, Shallow Cloning, Deep Cloning
Project: Clone_Method_Usage
Package: Employee_Data_Cloning
Programs:
1)Employee.java
2)Department.java
3)ETest.java
------------------------27/11/2023—Monday-----------------------------------------
Topic: Shallow Cloning, Deep Cloning, wait() method, Notify() method,
Packages: Employee_Data_Cloning, com.slokam
Programs: 1)EmployeeM.java 2)DepartmentM.java
3)One.java
4)Bank.java
5)Customer.java
Notes:
Actually why
------------------------28/11/2023—Tuesday-----------------------------------------
Topic: Deadlock (is a situation when threads are waiting for eachother).
Project: Deadlock, Deamon_Threads,Yield_Method
Packages:
1) Deadlock_Occurance_between_two_threads, 2) Deamon_Thread_Intro,
3)Default_Package
Programs:
1)Deadlock.java,2)Testdeamon.java, 3) 1TestYield.java
--------------------29/11/2023—Wednesday---------------------------------------
Topic:
Project:
Packages:
Programs:
---------------------4/12/2023-Monday-----------------------------------------------
Collections
Arraylist
Linkedlist
Vector—stack
Set
1)Hashset-Linkedhashset
2)TreeHashset
COLLECTION
COLLECTION
LINKEDHASHSET
2)TREE HASHSET
2)LINKEDLIST
3)VECTOR
STACK
How to import the class arraylist from one project to another project
How to clone method In arrayList
ARRAYLIST
Arraylist advantages: It is good add and retrieval of data
Disadvantages: It is not good for adding data in middle
LINKEDLIST
Linkedlist advantages: It is good to add data in middle of array
Linkedlist disadvantages: It is not good to add and retrieval of data in terms of
speed
VECTOR
Vector: It is same as arraylist but provides thread safety
In case of Vector For every method synronized is provided.
----------------------------------------5/12/2023-Tuesday-----------------------------------
Topic:ArrayList Methods, LinkedList Methods
Project:Collections
Package: ArrayList, LinkedList, Vector, Stack
Program: 1)Employee.java
2)Test.java
3)Employee.java
4)Test.java
5)Student.java
6)Test.java
7)Student.java
8)Test.java
Arraylist
Multilple employee objects
LinkedList
Has no random access
k.addFirst();
addlast();
removelastoccurence();
vector new
k.addelement
k.capacity
push,pop,peek in stack
AFTERNOON
Iterate
3 cursors
-----------------------------------------06/12/2023-Wednesday-----------------------------
Topic: (Morning)Cursors,Set-(Afternoon)
Morning
Afternoon
Projects:
Packages:
Programs:
SET
HASHSET
Set : Not allows duplicate data
Insertion order not preserved
Alloows all kinds of data and NULL
Hasset parent set set parent collection
LINKEDHASHSET
Insertion order preserved
Morning
Projects: Iteration Cursors, Collection SET
Packages:List_Iterator,HashSet, LinkedHashSet
Programs: 1)LIterator.java, 2)Test.java, 3)Test.java
Afternoon
Object class-hashcode,equals, ==
---------------------------------------07/12/2023—Thursday-----------------------------
(Checkonce)
Topic:Linked Hashset ,Tree set
Project: Collections SET
Package:
1)Difference_btw_working_of_hashcode_In_HashSet_And_ObjectClass,
2)TreeSet
Programs: employee1.java, LinkedHashSettest.java, Test.java
1. HashSet: The HashSet class does not rely on the compareTo method.
It uses the hashCode method and the equals method to determine
whether two objects are considered equal. The ordering of elements
in a HashSet is not based on their values, and it does not maintain
any specific order.
2. TreeSet: The TreeSet class, on the other hand, can use the
compareTo method (if elements implement the Comparable interface)
or a specified Comparator to determine the order of elements. If the
elements do not implement Comparable and no Comparator is
provided, the TreeSet will throw a ClassCastException at runtime.
----------------------------------------------08/12/2023-Friday----------------------------
------------------------------------------11/12/2023-Monday------------------------------
Tree Map
Afternoon
TryWithresources
----------------------------12/12/2023-Tuesday----------------------------------------
Topic:Threads
Project:Threads,Join_Method,Threads
Packages:RunnableInterface, Join,Callable_Interface
Programs:
Runnable Interface
1)Slokam.java
2)Employee.java
Join
1)Siva.java
2)Slokam.java(just practice again same as above)
Callable_Interface
1)testcall.java(Compulsory check it in rec)
--------------------13/12/2023-Wednesday--------------------------------------------------
Topic:Object Class methods(10)
toString,
Clone,
Wait,Notify,notiftall,
Project: Clone_Method_Usage
Packages:clone_13_12_2023
Programs:
Morning
Hashtable:
It doesnot take any null values
Values can be duplicate but no null values
Only tree set and tree map I can apply Comparable
Project: Maps
Package: HashTable
Programs:
1)Employee.java
2)Three.java
Project: Maps
Package: HashTable
Programs:
1)Employee.java
2)Three.java
-------------------------------14/12/2023—Thursday----------------------------------------
-------------------------------------------------30/12/2023-----------------------------------
JDBC
What is class----class.forname
How to connect database
What are the interface in jdbc
Drivermanager class
What is STATEMENT
What is PREPARED STATEMENT
What is CALLABLE STATEMENT
Batch update
Transactions
How to create basic procedure
How to call procedure
We have completed--------below topics
Curd operations
Joins – Relations—subqueries
Aggregate
Select count(*) from employee;
Select max(esal), min(esal), avgfrom
Having, we can apply only we can haveOrderby
Group by
Having
---------------------------22-01-2024----------------Monday----------------------------
Topic: String literals and String class
String constant pool and Heap Memory
Project: String literals and String Class
Package:
StringLiteralsAndStringClassIntroduction
Programs:
1)STest.java
Afternoon no class
-----------------------23-01-2024--------Tuesday--------------------------
Topic: How to create our own immutable class (INTERVIEW QUESTION)
Project: String literals and String Class
Package: How_to_create_custom_immutable_class
Programs: Employee.java
Etest.java
Department.java
Afternoon Hib relations class oto,otm,mtm
-----------27-03-2024-----------Wednesday-----------------------------------
TOPIC: SERIALIZATION AND DESERIALIZATION
PROJECT: Serialization AND Deserialization
PACKAGE: com.cisco
PROGRAMS:
1) empPojo.java
2) One.java
3) TestSerialization.java
4) TestDeserialization.java
1) empPojo.java
package com.cisco;
import java.io.Serializable;
public empPojo() {
@Override
public String toString() {
return "empPojo [eid=" + eid + ", ename=" +
ename + ", esal=" + esal + ", edesg=" + edesg + "]";
}
2) One.java
package com.cisco;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
try {
FileWriter fw = new FileWriter("E:\\html\\
Slokam\\sdes.txt",true);
BufferedWriter bw = new
BufferedWriter(fw);
bw.write("3,lucky,99.5,se");
bw.newLine();
bw.close();
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
FileReader fr = new FileReader("E:\\html\\
Slokam\\sdes.txt");
BufferedReader br = new
BufferedReader(fr);
for(String s = br.readLine();s!
=null;s=br.readLine()) {
System.out.println(s);
}
br.close();
fr.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
FileWriter fw = new FileWriter("E:\\html\\
Slokam\\sdes.txt",true);
BufferedWriter bw = new
BufferedWriter(fw);
empPojo k = new
empPojo(4,"aaa",95.5,"dev");
bw.write(k.getEid()+","+k.getEname()
+","+k.getEsal()+","+k.getEdesg());
//bw.write("3,lucky,99.5,se");
bw.newLine();
System.out.println("inserted");
bw.close();
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
3) TestSerialization.java
package com.cisco;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
empPojo e = new
empPojo(100,"loki",75.5,"dev");
SENDDATATOFILE(e);
}
Output:-
4)TestDeserialization.java
package com.cisco;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
e.printStackTrace();
}
}
Output:-
1) empPojo.java
package com.cisco;
import java.io.Serializable;
public empPojo() {
@Override
public String toString() {
return "empPojo [eid=" + eid + ", ename=" +
ename + ", esal=" + esal + ", edesg=" + edesg + "]";
}
2) TestSerialization.java
package com.cisco;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
}
3) TestDeserialization.java
package com.cisco;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
e.printStackTrace();
}
}
1) empPojo.java
package com.cisco;
import java.io.Serializable;
public empPojo() {
@Override
public String toString() {
return "empPojo [eid=" + eid + ", ename=" +
ename + ", esal=" + esal + ", edesg=" + edesg + ",
dep=" + dep
+ "]";
}
2) Department.java
package com.cisco;
3) TestSerialization.java
package com.cisco;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
}
4) TestDeserialization.java
package com.cisco;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
e.printStackTrace();
}
}
}
IS -A RELATION: IF YOU KEEP IMPLEMENTS SERIALIZABLE TO
empPojo
1) empPojo.java
package com.cisco;
import java.io.Serializable;
public empPojo() {
@Override
public String toString() {
return "empPojo [eid=" + eid + ", ename=" +
ename + ", esal=" + esal + ", edesg=" + edesg + ",
dep=" + dep
+ "]";
}
2) Department.java
package com.cisco;
import java.io.Serializable;
3) TestSerialization.java
package com.cisco;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
}
4) TestDeserialization.java
package com.cisco;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
e.printStackTrace();
}
}
AFTERNOON:
What is serialization
How to implement serialization
Serializable ID
Deserialization
Has – A Relation
Employee implements serialization extends dep – Not possible
A)Car.java
}
}
Psvm(){
Car c = new car();
c.display();
}
b) Test.java
class Test{
psvm(s[]a){
Car c = new Car();//Outer class object[cid]
Inner class k =c.new InnerClass();
k.display();
}
}
2) Test.java
package Static_inner_class;
import Static_inner_class.Car.Innerclass;