0% found this document useful (0 votes)
13 views5 pages

Full Stack Java Total Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Full Stack Java Total Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

oops:

inheritance
polymorphism
encapsulation

inheritance:
reading the properties from one class to another class
adv:reusability so that we can save time and memory

class A{
}
class B extends A{
}
types of inheritance
single
A
|
B
multiple
A B
C
note=java doesnot support multiple inheritance using classes
it supports by using interfaces.
multilevel
A
|
B
|
C
hierarchial
A
B C D E F
hybrid
A C
D
E F

POLYMORPHISM-many forms
2 types
compile time=method overloading
run time=method overriding

method overloading:
same method name with diff no of arguments(or)
same method name with same no of arguments but with diff datatypes

method overriding:
same method name with same no of arguments in super class and sub class
whenever we are having same method name with same no of arguments in super class
and sub class , by default sub class method is going to executed
if we want to execute superclass method also then we need to call super class
method in subclass method using super keyword
ex:super.show() [as used in the example for execution]
ENCAPSULATION

it is used to achieve security for our application


security is achieved by using private modifier
encapsulation=private variables +public methods
public methods=setters and getters
setter method is for setting the value
getter method is for getting the value
alt+shift+s->R = FOR setters and getters

CONSTRUCTORS:

constructor is also one kind of method which can be called automatically when we
create an object
rules to define a constructor:
1.class name and constructor name should be same
2.no return type for a constructor

default constructor
parameterized constructor
constructor overloading
constructor chaining

ABSTRACTION:

acheived by using 2 ways:


1.abstract class
2.interfaces

methods:
2 types of methods
1.concrete methods: we provide implementation /logic
2.abstract methods: we provide any implementation ,just we declare the methods by
using abstract modifier

class vs abstract class vs interface

class-complete implementation
abstract class-partial implementation
interface-no implementation,just we declare the methods

class declaration;
class <classname>{
contains implementation
contains both concrete and abstract methods}

abstract class declaration


abstract class <classname>{

interface declaration
interface <interfacename>
{
no implementation
contains only abstract methods

clas->class=> extends
interface->interface=>extends
interface->class=>implements

control statements in java


---------------------
1.conditional:if , if -else,else-if

JDBC:::Java Database connectivity

-> to communicate our java application with data base,we need a driver
-> driver act as a mediator between java application and database
-> we have 4 types of drivers
type 1 -> JDBC ODBC bridge driver(c language->platform dependent)
type 2 -> native API driver(c++ language->partially platform dependent)
type 3 -> net protocol driver(java language -> protocol dependent )
type 4 -> pure java driver(completely developed by using java lang)
we only work with type 4 driver

------------------------------------------------
steps to connect java application with database:
1. load the driver.
2. create connection.
3. create statement.
4. execute the queries.
5. close the connection.
------------------------------------------------

NOTE: when we are working with JDBC, database specific library/Jar file
we need to add to our project.'
if we don't add, we will get classNoFoundException.

adding jar file to our project

servlets:
it is a technology used for developing web applications
it follows client server architecture
client send a request
server sends the response
--------------------------
ways to create a servlet
we have 3 ways to create a servlet:
1.implementing servlet interface
2.extending generic servlet
3.extending httpservlet
-----------------
steps to develop a web application using servlets:
1. create a dynamic webproject.
2. under java resources -src-create package - new package -new servlet.
3. define the servlet in web.xml file.
4. run on server.
-------------------------------------
=>If you are developing web application,we need one server
=> here, we use apache tomcat webserver to develop a web application
NOTE: how to add tomcat server to our eclipse IDE

SERVLET EXAMPLE PROJECTS:


1.Implementing servlet interface
2.Extending generic servlet
3.Extending http servlet
4. HTML with servlet communication
5. HTML with servlet & database communication
6.servlet with servlet communication
7. servlet config
8. servlet context

===================================
JSP=java server pages:
-> using jsp we develop web applications.
-> we have some problems in servlets,to over the problems of servlets we go for
JSP.

LIMITATIONS:
-> lengthy code.
-> if we do any modification or changes, everytime,we do to restart the project.
-> whatever the servlets we are creating,each and every servlets we need to define
in web.xml file.

NOTE: To overcome the problems of servlets we go for JSP.

ADVANTAGES:-
1.less code in JSP.
2.If we do any modifications in JSP, we need not to restart, simply we need to
refresh the page.
3.we no need to create JSP files in web.xml file.

JSP=HTML+JAVA
-> It is a cobo of html and java.

NOTE:all the html files and JSP files,we need to create inside the web content
folder.

JSP ELEMENTS:-
Scripting elements
directive elements
action elements
=> Scripting elements:
1.Scripting tags: <% %s
2.Exprression tags: <%= %>
3.Declaration tags: <%! %>

You might also like