0% found this document useful (0 votes)
2 views3 pages

Advanced Java Notes

The document covers advanced Java topics including JDBC, Servlets, JSP, Collections, Multithreading, Networking, Lambda expressions, and Stream API. It provides code examples for each topic, demonstrating basic operations such as database insertion, servlet creation, and using collections. The content serves as a quick reference for Java programmers looking to enhance their skills in these areas.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Advanced Java Notes

The document covers advanced Java topics including JDBC, Servlets, JSP, Collections, Multithreading, Networking, Lambda expressions, and Stream API. It provides code examples for each topic, demonstrating basic operations such as database insertion, servlet creation, and using collections. The content serves as a quick reference for Java programmers looking to enhance their skills in these areas.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Advanced Java Topics & Programs

1. JDBC

-------

Steps: Load driver, connect, statement, execute, close.

Example:

import [Link].*;

class InsertExample {

public static void main(String[] a){

try{

[Link]("[Link]");

Connection con=[Link]("jdbc:mysql://localhost:3306/testdb","root","password");

Statement st=[Link]();

[Link]("insert into student values(101,'Shalini')");

[Link]();

}catch(Exception e){[Link](e);}

2. Servlets

-----------

Example:

public class HelloServlet extends [Link]{

public void service(ServletRequest req, ServletResponse res)throws IOException{

[Link]("text/html");

PrintWriter out=[Link]();

[Link]("Hello from Servlet");


}

3. JSP

------

<%@ page language="java" %>

Welcome User

4. Collections

---------------

ArrayList:

ArrayList list=new ArrayList<>();

[Link]("Java");

HashMap:

HashMap map=new HashMap<>();

[Link](1,"Apple");

5. Multithreading

------------------

class A extends Thread{

public void run(){[Link]("Thread running");}

6. Networking

--------------

ServerSocket ss=new ServerSocket(5000);

Socket s=[Link]();

7. Lambda
----------

Say s = ()->[Link]("Hello");

8. Stream API

--------------

[Link]().filter(n->n>20).forEach([Link]::println);

You might also like