advance java - PowerPoint PPT Presentation

About This Presentation
Title:

advance java

Description:

free – PowerPoint PPT presentation

Number of Views:15
Slides: 23
Provided by: 9839990389
Tags: fff

less

Transcript and Presenter's Notes

Title: advance java


1
Buddha Institute Of Technology, Gida,
Gorakhpur
  • PRESENTATION ON ADVANCE JAVA

Dhananjay Prajapati
(1452510903) Department of Computer science and
Eng. 4th year
2
Content
  1. Introduction
  2. Collection
  3. Multithreading
  4. Java - Networking
  5. AWT
  6. Swing
  7. JDBC
  8. JSP
  9. Applet

3
Introduction
  • Java programming language was originally
    developed by Sun Microsystems which was initiated
    by James Gosling and released in 1995 as core
    component of Sun Microsystems' Java platform
    (Java 1.0 J2SE). The latest release of the Java
    Standard Edition is Java SE 8.
  • Object Oriented - In Java, everything is an
    Object. Java can be easily extended since it is
    based on the Object model.
  • Platform Independent - it is not compiled into
    platform specific machine, rather into platform
    independent byte code. This byte code is
    distributed over the web and interpreted by the
    Virtual Machine (JVM) on whichever platform it is
    being run on.
  • Simple - Java is designed to be easy to learn. If
    you understand the basic concept of OOP Java, it
    would be easy to master.
  • Secure - With Java's secure feature it enables to
    develop virus-free, tamper-free systems.
    Authentication techniques are based on public-key
    encryption.

4
Collection
  • Collection framework provides a well designed set
    of interface and classes for storing and
    manipulating groups of data as a signal unit a
    collection.
  • It provides a standard programming interface to
    many of the most common abstractions, without
    blundering the programmer with to many procedure
    and interfaces.
  • Collocation tree part-
  • 1. List-Array List
  • 2. Set- Tree set ,Hash set, Link hash set
  • 3. map- Hash Map, Hash Table, Tree Map

5
Multithreading
  • Java is multithreaded programming language which
    means we can develop multithreaded program using
    java. A multithreaded program contains two or
    more parts that can ran concurrently and each
    part can handle different task at the same time
    making optimal use of the available resources
    specially when your computer has multiple CPU.

6
Life Cycle of a Thread
New
Runnable
Unlock signal signal all
Thread completes
Await Sleep
Interval expires
Await lock
Waiting
Terminated
Timed Waiting
7
Java-Networking
  • The term Network programming refers to writing
    programs that execute across multiple
    devices(Computers), In which the devices are all
    connected to each other using a networks.
  • The Java net package of the J2se API contains a
    collection of classes and interfaces that provide
    the low-level communication details, allowing you
    to write programs that focuses on solving problem
    at hand.
  • The java net package provides support for the two
    common network protocols.

8
Networks Protocols
  • TCP- TCP stands for transmission control
    protocol, which allows for reliable communication
    between two application. TCP is typically used
    over the Internet Protocol, which is referred to
    as TCP/IP.
  • UDP- UDP stands for User Datagram Protocol, a
    connection-less protocol that allows for packets
    of data to be transmitters between application.
  • Socket programming- This is most widely used
    concept in networking and it has been explained
    in very details.
  • URL Processing- This would be covered separately.
    Click here to learn about URL Processing in java
    language

9
AWT(Abstract windowing Toolkit)
  • Java AWT (Abstract Windowing Toolkit) is an API
    to develop GUI or window-based application in
    java.
  • 1) AWT components are platform-dependent.
  • 2) AWT components are heavyweight.
  • 3)AWT doesn't support pluggable look and feel.
  • 4) AWT provides less components than Swing.
  • 5) AWT doesn't follows MVC(Model View Controller)
    where model represents data, view represents
    presentation and controller acts as an interface
    between model and view.

10
Java AWT Hierarchy
11
AWT Program
  • import java.awt.   
  • class First extends Frame
  •   
  • First()
  •   
  • Button bnew Button("click me")   
  • b.setBounds(30,100,80,30)
    // setting button position   
  • add(b)
    //adding button into frame   
  • setSize(300,300)
    //frame size 300 width and 300 height   
  • setLayout(null)
    //no layout manager   
  • setVisible(true)
    //now frame will be visible, by default not visibl
    e   
  •   
  • public static void main(String args)   
  • First fnew First()   
  •   

12
Swing
  • Java Swing is a part of Java Foundation Classes
    (JFC) that is used to create window-based
    applications. It is built on the top of AWT
    (Abstract Windowing Toolkit) API and entirely
    written in java.
  • 1) Java swing components are platform-independent.
  • 2) Swing components are lightweight.
  • 3) Swing supports pluggable look and feel.
  • 4) Swing provides more powerful components such
    as tables, lists, scroll panes, color chooser,
    tabbed pane etc.
  • 5) Swing follows MVC.

13
Swing API
14
Swing Program
  • Simple Java Swing Example
  • import javax.swing.   
  • public class FirstSwingExample 
  •   
  • public static void main(String args)
  •     
  • JFrame fnew JFrame()
    //creating instance of JFrame              
  • JButton bnew JButton("click")
    //creating instance of JButton   
  • b.setBounds(130,100,100, 40)
    //x axis, y axis, width, height             
  • f.add(b)
    //adding button in JFrame            
  • f.setSize(400,500)
    //400 width and 500 height   
  • f.setLayout(null)
    //using no layout managers   
  • f.setVisible(true)
    //making the frame visible   
  •   
  •   

15
JDBC(Java Data Base Connectivity)
  • Java Database Connectivity(JDBC) is
    an Application Programming Interface(API) used to
    connect Java application with Database. JDBC is
    used to interact with various type of Database
    such as Oracle, MS Access, My SQL and SQL Server.
    JDBC can also be defined as the
    platform-independent interface between a
    relational database and Java programming. It
    allows java program to execute SQL statement and
    retrieve result from database.
  • Steps to connect a Java Application to Database
  • The following 5 steps are the basic steps
    involve in connecting a Java application with
    Database using JDBC.

16
JDBC
  1. Register the Driver(Class.forName("sun.jdbc.odbc.J
    dbcOdbcDriver") )
  2. Create a Connection (Connection con
    DriverManager.getConnection ("jdbcoraclethin_at_lo
    calhost1521XE","username","password"))
  3. Create SQL Statement- Statement
    scon.createStatement()
  4. Execute SQL Statement- (ResultSet
    rss.executeQuery("select from user")
    while(rs.next()) System.out.println(rs.getString
    (1)" "rs.getString(2)) )
  5. Closing the connection- con.close()

17
JSP(Java Server Page)
  • Java Server Pages (JSP) is a server-side
    programming technology that enables the creation
    of dynamic, platform-independent method for
    building Web-based applications. JSP have access
    to the entire family of Java APIs, including the
    JDBC API to access enterprise databases.
  • The following are the paths followed by a JSP
  • Compilation
  • Initialization (public void jspInit() )
  • Execution (void _jspService(HttpServletRequest
    request, HttpServletResponse response) )
  • Cleanup (public void jspDestroy() )

18
Working
19
JSP Syntax
  • Syntax
    Purpose
  • jspinclude Includes a file at the time
    the page is requested
  • jspuseBean Finds or instantiates a
    JavaBean
  • jspsetProperty Sets the property of a
    JavaBean
  • jspgetProperty Inserts the property of a
    JavaBean into
  • jspforward Forwards the requester to a
    new page
  • jspplugin Generates browser-specific
    code that makes an OBJECT or EMBED tag for
    the Java plugin
  • jspelement Defines XML elements
    dynamically.

20
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.
  • Lifecycle of Java Applet
  • 1.public void init() is used to initialized the
    Applet. It is invoked only once.
  • 2.public void start() is invoked after the
    init() method or browser is maximized. It is used
    to start the Applet.
  • 3.public void stop() is used to stop the Applet.
    It is invoked when Applet is stop or browser is
    minimized.
  • 4.public void destroy() is used to destroy the
    Applet. It is invoked only once.

21
Program Applet
  • import java.applet.Applet   
  • import java.awt.Graphics   
  • public class First extends Applet
  •     
  • public void paint(Graphics g)
  •   
  • g.drawString("welcome",150,150)   
  •    
  •   
  • Note class must be public because its object is
    created by Java Plug in software that resides on
    the browser.
  • myapplet.html
  • lthtmlgt   
  • ltbodygt   
  • ltapplet code"First.class" width"300" height"300
    "gt   
  • lt/appletgt   
  • lt/bodygt   
  • lt/htmlgt  

22
  • Thank You
Write a Comment
User Comments (0)
About PowerShow.com