16. Threads in Java
Non-Threaded Applications
Threaded Applications
Process based multitasking Vs Thread based multitasking
Thread API in Java
Creating Threads
States of a Thread
Synchronization for threads; static and non-static synchronized methods; blocks; concept of object and class locks
Coordination between threads - wait, notify and notifyAll methods for inter-thread communication
17. Applets
What are applets?
Need for Applets
Different ways of running an applet program
Applet API hierarchy
Life Cycle of an applet
Even Handlers for applets, mouse events, click events
18. Swing GUI
Introduction to AWT
Introduction to Swing GUI
Advantages of Swing over AWT
Swing API
Swing GUI Components
Event Handlers for Swing
Sample Calculator application using Swing GUI and Swing Event handling
19. JDBC
What is JDBC; introduction
JDBC features
JDBC Drivers
Setting up a database and creating a schema
Writing JDBC code to connect to DB
CRUD Operations with JDBC
Statement types in JDBC
Types of Rowset, ResultSet in JDBC
20. Access Modifiers in Java
What are access modifiers?
Default
Protected
Private
Public
ava Introduction - What is Java? Where is Java being Used? types of Java applications, facts about Java, different editions of Java technology, what you will need to run Java and about popular Java Editors.
In this core Java training sessions, you will learn the basics of Java programming language. Following are the topics I have included in this presentations:
1. History of Java
2. Major features of Java
3. Classes and Objects
4. Class members
5. Packages
6. Constructors
7. Abstract Classes
8. Interfaces
9. OOP Characteristics
10. Access & Non-Access Modifiers
11. Passing variables
12. String
Core Java introduction | Basics | free course Kernel Training
http://kerneltraining.com/core-java/
Learn the basics of Java and gain practical experience that is required to begin your career in java programming. Kernel Training has designed classroom and online course to upgrade your knowledge and skills in core Java.
Course Curriculum:
Introduction to Java
JDK and practical applications
Java Basic Data Types and Operators
Programming Constructs, Classes and Methods, constructor and Finalizer
Polymorphism
Inheritance
Method overriding and abstract classes
Packages and Interfaces
Strings and Arrays
Enums
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Quick review of some important concepts from last class
• History of Java
• JDK and JRE
• Byte Code and JVM (Java Virtual Machine)
• Platform Independence
• Principles of Object Oriented Programming
• Writing your first Java Application
• Elements of Java programming language
• Built in Data Types
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
ava Introduction - What is Java? Where is Java being Used? types of Java applications, facts about Java, different editions of Java technology, what you will need to run Java and about popular Java Editors.
In this core Java training sessions, you will learn the basics of Java programming language. Following are the topics I have included in this presentations:
1. History of Java
2. Major features of Java
3. Classes and Objects
4. Class members
5. Packages
6. Constructors
7. Abstract Classes
8. Interfaces
9. OOP Characteristics
10. Access & Non-Access Modifiers
11. Passing variables
12. String
Core Java introduction | Basics | free course Kernel Training
http://kerneltraining.com/core-java/
Learn the basics of Java and gain practical experience that is required to begin your career in java programming. Kernel Training has designed classroom and online course to upgrade your knowledge and skills in core Java.
Course Curriculum:
Introduction to Java
JDK and practical applications
Java Basic Data Types and Operators
Programming Constructs, Classes and Methods, constructor and Finalizer
Polymorphism
Inheritance
Method overriding and abstract classes
Packages and Interfaces
Strings and Arrays
Enums
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Quick review of some important concepts from last class
• History of Java
• JDK and JRE
• Byte Code and JVM (Java Virtual Machine)
• Platform Independence
• Principles of Object Oriented Programming
• Writing your first Java Application
• Elements of Java programming language
• Built in Data Types
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Core Java Tutorial. In case you want to get trained in Spring Framework you can refer here:
<a href="https://www.emexotechnologies.com/courses/java-development-training/core-java-training/">Java Training</a>
In this presentation we introduce topic of core java that is required to learn if you want to be good java programmer. i provide all concept in detail.
Here I discuss about Java programming language and easiest way to solve programming problem. Java basic syntax and their uses are described briefly so that anyone can easily understand within very short time. If anyone follow the slide with proper way,I assure that he or she will find java programming interesting.
Introduction to JAVA Programming
When Java?
Why Java?
How Java?
Where Java?
Architecture of java
Byte code of class file
Java class file to byte code class file.
Tools and Technology
Net-beans, Eclipse
This presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
Java Programming | Java Tutorial For Beginners | Java Training | EdurekaEdureka!
This Edureka Java Programming tutorial will help you in understanding the various programming fundamentals of Java in detail with examples. Below are the topics covered in this tutorial:
1) Variables
2) Data Types in Java
3) Operators in Java
4) Conditional Statements in Java
5) Loops
6) Arrays and Strings
7) Functions in Java
8) Classes and Objects in Java
What are the top 10 Java Interview Questions and Answers in 2014? Based on the most popular java questions asked in interview, we've compiled a list of the 10 most popular java interview questions in 2014.
Appearing for a java interview is not easy but if you brush up enough fundamentals, then you can easily crack the interview. The above questions are the most popular java interview questions asked by major companies so make sure to download this pdf.
This list includes java interview questions in the below categories:
top 10 java interview questions
top 10 java interview questions and answers
10 most popular interview questions
core java interview questions and answers
basic java interview questions and answers
serialization in java interview questions
core java interview questions pdf
multithreading in java interview questions
advanced java interview questions and answers
top 10 java interview questions and answers for freshers
top 100 java interview questions and answers
java interview questions and answers pdf
java interview questions and answers for freshers
java interview questions and answers for experienced
java interview questions and answers for 3 years experience
java interview questions and answers pdf download
java collections interview questions and answers
Core Java Tutorial. In case you want to get trained in Spring Framework you can refer here:
<a href="https://www.emexotechnologies.com/courses/java-development-training/core-java-training/">Java Training</a>
In this presentation we introduce topic of core java that is required to learn if you want to be good java programmer. i provide all concept in detail.
Here I discuss about Java programming language and easiest way to solve programming problem. Java basic syntax and their uses are described briefly so that anyone can easily understand within very short time. If anyone follow the slide with proper way,I assure that he or she will find java programming interesting.
Introduction to JAVA Programming
When Java?
Why Java?
How Java?
Where Java?
Architecture of java
Byte code of class file
Java class file to byte code class file.
Tools and Technology
Net-beans, Eclipse
This presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
Java Programming | Java Tutorial For Beginners | Java Training | EdurekaEdureka!
This Edureka Java Programming tutorial will help you in understanding the various programming fundamentals of Java in detail with examples. Below are the topics covered in this tutorial:
1) Variables
2) Data Types in Java
3) Operators in Java
4) Conditional Statements in Java
5) Loops
6) Arrays and Strings
7) Functions in Java
8) Classes and Objects in Java
What are the top 10 Java Interview Questions and Answers in 2014? Based on the most popular java questions asked in interview, we've compiled a list of the 10 most popular java interview questions in 2014.
Appearing for a java interview is not easy but if you brush up enough fundamentals, then you can easily crack the interview. The above questions are the most popular java interview questions asked by major companies so make sure to download this pdf.
This list includes java interview questions in the below categories:
top 10 java interview questions
top 10 java interview questions and answers
10 most popular interview questions
core java interview questions and answers
basic java interview questions and answers
serialization in java interview questions
core java interview questions pdf
multithreading in java interview questions
advanced java interview questions and answers
top 10 java interview questions and answers for freshers
top 100 java interview questions and answers
java interview questions and answers pdf
java interview questions and answers for freshers
java interview questions and answers for experienced
java interview questions and answers for 3 years experience
java interview questions and answers pdf download
java collections interview questions and answers
Java programming presentations By Daroko blog
Do not just read java as a programmer, find projects and start making some Money, at DAROKO BLOG,WE Guide you through what you have learned in the classroom to a real business Environment, find java applications to a real business Environment, find also all IT Solutions and How you can apply them, find the best companies where you can get the IT jobs worldwide, Find java contract, Complete and start making some cash, find clients within your Country, refer and get paid when you complete the work.
Not Just a contact, at daroko Blog (www.professionalbloggertricks.com/),you are also being taught how you can apply all IT related field in real world.
Simply Google, Daroko Blog or visit (www.professionalbloggertricks.com/) to Know More about all these service now.
Do not just learn and go, apply them in real world.
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Sagar Verma
Collection Framework in Java,Generics,Input-Output in Java,Serialization,Inner Classes
Collection Framework in Java
The Collections Framework - Set Interface- List Interface - Map Interface - Queue Interface -Sorting collections using utility methods
equals () and hash Code contract in Java collections
Overriding equals and hash Code methods in Java
Generics
Generics for Collections, class and methods
Input-Output in Java
What is a stream? ,Bytes vs. Characters, Java IO API ,Reading a file; writing to a file using various APIs
Reading User input from console , PrintWriter Class
Serialization
Object Serialization , Serializable Interface , De-Serializable
Inner Classes
Inner Classes ,Member Classes, Local Classes, Anonymous Classes, Static Nested Classes
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
OOPS and its application in Java, Super class AND This Keyword,Java Bean, POJO ,Memory management in Java ,Packages ,Miscellaneous (Var-Args, toString(), Double equals operator(==))
EEW Technologies is simply Academic and Live Project Developing industry. EEW has been the industry's standard done more than 250 IEEE projects.
2015 -16 software project list.All type of project will be implemented and research is also done.
Several anonymization techniques, such as generalization and bucketization, have been designed for privacy preserving microdata publishing. Recent work has shown that generalization loses considerable amount of information, especially for high-dimensional data. Bucketization, on the other hand, does not prevent membership disclosure and does not apply for data that do not have a clear separation between quasi-identifying attributes and sensitive attributes. In this paper, we present a novel technique called slicing, which partitions the data both horizontally and vertically. We show that slicing preserves better data utility than generalization and can be used for membership disclosure protection. Another important advantage of slicing is that it can handle high-dimensional data. We show how slicing can be used for attribute disclosure protection and develop an efficient algorithm for computing the sliced data that obey the ℓ-diversity requirement. Our workload experiments confirm that slicing preserves better utility than generalization and is more effective than bucketization in workloads involving the sensitive attribute. Our experiments also demonstrate that slicing can be used to prevent membership disclosure.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Access Modifiers in Java | Java Program
1. Java Class 6
“Don't worry if it doesn't work right [when coding]. If
everything did, you'd be out of a job.”
Agenda
•Threads in Java
•Applets
•Swing GUI
•JDBC
•Access Modifiers in Java
2. Java Values 2
What is a Thread?
•A thread is a lightweight sub-process, the smallest unit of
processing.
•Multiprocessing and multithreading, both are used to achieve
multitasking.
•Represents a separate path of execution of a group of
statements
•Java is the first language to include threading within the
language, rather than treating it as a facility of the OS
•Video Game example
1.one thread for graphics
2.one thread for user interaction
3.one thread for networking
•Server Example
1.Do various jobs
2.Handle Several Clients
Advantage:
1. Easier
2. better Performance
3. Multiple task
4.Share Resource
3. Java Values 3
Main Thread
Default Thread in any Java Program
JVM uses to execute program statements
Program To Find the Main Thread
Class Current
{
public static void main(String args[])
{
Thread t=Thread.currentThread();
System.out.println(“Current Thread: “+t);
System.out.println(“Name is: “+t.getName());
}
}
Output??
4. Threads in Java
Java Values 4
•Creating threads in Java:
1. Extend java.lang.Thread class
run() method must be overridden (similar to main method
of sequential program)
•run() is called when execution of the thread begins
•A thread terminates when run() returns
•start() method invokes run()
2. Implement java.lang.Runnable interface
Methods : run() , Start (), Sleep(), Wait (), Join(), getPriority()
, setPriority(), notify(), notifyall(),yield(),getname(), getid(),
isAlive(), currentthread(), isDaemon(),setDaemon() etc….
6. New
The thread is in new state if you create an instance of Thread
class but before the invocation of start() method.
Runnable
The thread is in runnable state after invocation of start()
method, but the thread scheduler has not selected it to be the
running thread.
Running
The thread is in running state if the thread scheduler has
selected it
Non-Runnable (Blocked)
This is the state when the thread is still alive, but is currently
not eligible to run.
Terminated
A thread is in terminated or dead state when its run() method
exits. Java Values 6
7. Thread Priority
Each thread is assigned a default priority of
Thread.NORM_PRIORITY (constant of 5).
You can reset the priority using setPriority (int priority).
Some constants for priorities include:
o Thread.MIN_PRIORITY (1)
o Thread.MAX_PRIORITY (10)
Daemon thread in java is a service provider thread that
provides services to the user thread. Its life depend on the
mercy of user threads i.e. when all the user threads dies, JVM
terminates this thread automatically.
There are many java daemon threads running automatically
e.g. gc, finalizer etc.
setDaemon(); isDaemon() is a method used for daemon thread.
Java Values 7
8. Thread Synchronization
Java Values 8
•A shared resource may be corrupted if it is accessed
simultaneously by multiple threads.
•Example: two unsynchronized threads accessing the same
bank account may cause conflict.
• Known as a race condition in multithreaded programs.
•A thread-safe class does not cause a race condition in the
presence of multiple threads.
•Problem : race conditions
•Solution : give exclusive access to one thread at a time to code
that manipulates a shared object.
•It keeps other threads waiting until the object is available.
•The synchronized keyword synchronizes the method so that only
one thread can access the method at a time.
public synchronized void xMethod() {
// method body
}
obj
T1 (enter inside obj)
T2 (wait till T1 finish)
9. Deadlock
Apart of multithreading
Can occur when a thread is waiting for an object lock, that is acquired by
another thread and second thread is waiting for an object lock that is
acquired by first thread
Since, both threads are waiting for each other to release the lock, the
condition is called deadlock
Preventing Deadlock
Deadlock can be easily avoided by resource ordering.
With this technique, assign an order on all the objects whose locks must be
acquired and ensure that the locks are acquired in that order.
Example:
Thread 1: lock A lock B
Thread 2: wait for A lock C(when A is locked)
Thread 3: wait for A wait for B wait for C
Java Values 9
10. Inter-thread communication in Java
Inter-thread communication or Co-operation is all about
allowing synchronized threads to communicate with each other.
It is implemented by following methods of Object class:
wait()
notify()
notifyAll()
Java Values 10
wait() sleep()
wait() method releases the lock sleep() method doesn't release the lock.
is the method of Object class is the method of Thread class
is the non-static method is the static method
is the non-static method is the static method
should be notified by notify() or
notifyAll() methods
after the specified amount of time, sleep
is completed.
11. Applets
Applet is a special type of program that is embedded in the
webpage to generate the dynamic content. It runs inside the
browser and works at client side.
Advantage of Applet
– It works at client side so less response time.
– Secured
– It can be executed by browsers running under many
plateforms, including Linux, Windows, Mac Os etc.
Drawback of Applet
– Plugin is required at client browser to execute applet.
Java Values 11
12. public void init(): is used to initialized the Applet. It is
invoked only once.
public void start(): is invoked after the init() method or
browser is maximized. It is used to start the Applet.
public void stop(): is used to stop the Applet. It is invoked
when Applet is stop or browser is minimized.
public void destroy():
is used to destroy the Applet.
It is invoked only once.
public void paint(Graphics g):
is used to paint the Applet.
It provides Graphics class
object that can be used for drawing
oval, rectangle, arc etc.
Lifecycle of Java Applet
Java values
13. How to run an Applet?
There are two ways to run an applet
By html file.
By appletViewer tool (for testing purpose).
Html file Example:
import java.applet.Applet;
import java.awt.Graphics;
public class First extends Applet{
public void paint(Graphics g){
g.drawString("welcome",150,150);
}
}
<html>
<body>
<applet code="First.class" width="300" height="300">
</applet>
</body>
</html>
Java Values 13
Output?
14. Swing GUI
What is Java Swing ?
• Part of the Java Foundation Classes (JFC)
• Provides a rich set of GUI components.
• Used to create a Java program with a graphical user
interface (GUI)
Features Of Swing
1) Java Look and Feel
2) Data Transfer
3) Internationalization and Localization
4) Accessibility
5) System Tray Icon Support
Java Values 14
15. Java Swing Components…
• Top Level Containers
• General Purpose Containers
• Special Purpose Containers
• Basic Controls
• Un-editable Information Displays
• Interactive Displays of Highly Formatted Information
Java Values 15
20. Implementing an Event Handler
• Implement the methods in the listener interface to
handle the event.
Conclusion
• You can use any helpful tools out there that are for
Java development like eclipse IDE, NetBeans IDE.
We will see all the swing component Examples while
doing Desktop application using Netbeans IDE.
Java Values 20
21. JDBC
Java Values 21
JDBC stands for Java Database Connectivity. JDBC is
a Java API to connect and execute the query with the
database. It is a part of JavaSE (Java Standard Edition).
JDBC API uses JDBC drivers to connect with the
database.
Four types of JDBC drivers
1. JDBC-ODBC Bridge Driver,
2. Native Driver,
3. Network Protocol Driver, and
4. Thin Driver
22. Why Should We Use JDBC
Before JDBC, ODBC API was the database API to connect and
execute the query with the database.
But, ODBC API uses ODBC driver which is written in C
language (i.e. platform dependent and unsecured).
That is why Java has defined its own API (JDBC API) that uses
JDBC drivers (written in Java language).
We can use JDBC API to handle database using Java program
and can perform the following activities:
1. Connect to the database
2. Execute queries and update statements to the database
3. Retrieve the result received from the database.
Java Values 22
23. Java Database Connectivity with 5 Steps
import java.sql.*;
class OracleCon{
public static void main(String args[]){
try{
//step1 load the driver class
Class.forName("com.mysql.jdbc.Driver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/sonoo","root","root");
//step3 create the statement object
Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select * from emp");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
//step5 close the connection object
con.close();
}catch(Exception e){ System.out.println(e);}
}
}
24. Statement interface
Java Values 24
1) public ResultSet executeQuery(String sql): is used to execute
SELECT query. It returns the object of ResultSet.
2) public int executeUpdate(String sql): is used to execute
specified query, it may be create, drop, insert, update, delete etc.
3) public boolean execute(String sql): is used to execute queries
that may return multiple results.
4) public int[] executeBatch(): is used to execute batch of
commands.
•The Statement interface provides methods to execute
queries with the database.
•The statement interface is a factory of ResultSet i.e. it
provides factory method to get the object of ResultSet.
•Commonly used methods of Statement interface:
25. Java Values 25
JDBC RowSet
•The instance of RowSet is the java bean component
because it has properties and java bean notification
mechanism.
•It is introduced since JDK 5.
•It is the wrapper of ResultSet.
•It holds tabular data like ResultSet but it is easy and
flexible to use.
Advantage of RowSet
The advantages of using RowSet are
given below:
•It is easy and flexible to use
•It is Scrollable and Updatable by
default
26. Java Values 26
Statement PreparedStatement CallableStatement
It is used to execute normal
SQL queries.
It is used to execute
parameterized or dynamic
SQL queries.
It is used to call the stored
procedures.
It is preferred when a
particular SQL query is to
be executed only once.
It is preferred when a
particular query is to be
executed multiple times.
It is preferred when the
stored procedures are to be
executed.
You cannot pass the
parameters to SQL query
using this interface.
You can pass the
parameters to SQL query at
run time using this interface.
You can pass 3 types of
parameters using this
interface. They are – IN,
OUT and IN OUT.
This interface is mainly
used for DDL statements
like CREATE, ALTER,
DROP etc.
It is used for any
kind of SQL queries which
are to be executed multiple
times.
It is used to execute stored
procedures and functions.
The performance of this
interface is very low.
The performance of this
interface is better than the
Statement interface (when
used for multiple execution
of same query).
The performance of this
interface is high
27. Access Modifiers in Java
The access modifiers in Java specifies the accessibility or
scope of a field, method, constructor, or class.
We can change the access level of fields, constructors,
methods, and class by applying the access modifier on it.
Private: The access level of a private modifier is only within the class. It
cannot be accessed from outside the class.
Default: The access level of a default modifier is only within the
package. It cannot be accessed from outside the package. If you do not
specify any access level, it will be the default.
Protected: The access level of a protected modifier is within the
package and outside the package through child class. If you do not
make the child class, it cannot be accessed from outside the package.
Public: The access level of a public modifier is everywhere. It can be
accessed from within the class, outside the class, within the package
and outside the package.
Java Values 27
28. Access Modifiers in Java
There are many non-access modifiers, such as
static, abstract, synchronized, native, volatile, transient, etc.
A class cannot be private or protected except nested class.
Java Values 28
Access
Modifier
within class within
package
outside
package by
subclass only
outside
package
Private Y N N N
Default Y Y N N
Protected Y Y Y N
Public Y Y Y Y
29. Summary
Threads in Java
Process , Thread , Lifecycle of thread, Multithread,
communication between thread, Synchronization, priority
Daemon thread etc
Applets
what is applet, life cycle , and example and uses.
Swing GUI
Component, events, used and advantage
JDBC
Introduction, features,Drivers,Writing JDBC code to connect to DB,CRUD
Operations, Statement types ,Rowset, ResultSet
Access Modifiers in Java
Java Values 29
30. Java Values 30
Thank you !!!
GitHub Repository : https://github.com/eewsagar
YouTube: https://youtu.be/TBpu4Tlu7Q8
For any question please feel free to
comment.
Never
Assume
Clear it !!!