0% found this document useful (0 votes)
6 views7 pages

Java

java basics !

Uploaded by

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

Java

java basics !

Uploaded by

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

Concept of OOPS:-

————————————————————————18/07/25
——————————————————————
Method: Overriding->
—————————-
Re-writing of base class method into derived class is called method
overriding.

Rules for method overriding->


—————————————
1.Class must be inherited
2.Base class method name and derived class method name must be
same .
3.Base class methods parameter and derived class parameter must be
same.

Code to connect java application to oracle ->


————————————————————

Class Connection{
Public void connect (){
//code to connect oracle database
}
}

If in case you have change your db too mysql or any other

Class NewConnection extends connection{


Public void connect(){
//code to connect oracle database
}
}

Exception Handling
———————————————————————19/07/25
————————————————————

The term Exception Means abnormal termination ,


when exception is occurred program is terminated abnormally and rest
of code will not be executed.

Types of Exception:-
—————————
1.Checked exception
2. Unchecked Exception
3.Errors

1-Checked Exception-
——————————
Checked exceptions are those exceptions which occurred at compile
time
e.g. IOException, Interrupted Exceptions, ClassNotFound
Exception,FileNotFound Exceptions

2-UnChecked Exception-
——————————
Checked exceptions are those exceptions which occurred at Run time
E.g. Arithmatic Exception, Input MissMatch Exception, Array index out of
bounds Exception,
Null Pointer Exception,

3-Error-
————
Error occurred due to lack of system resources, are also a type of
unchecked exceptions,
E.g. IOError ,heap Memory Full error, Awterror

Exception Handling:-
—————————
Exception handling is mechanism to handle exception to achieve normal
execution of program .
For Exception handling in java we use TRY. ||CATCH ||FINALLY ||
THROW. ||THROWS

In java there are tow ways to handle exceptions .

1-By using try-catch block


2-By using throws keywords
Syntax to handle exception using try-catch blocks:-
——————————————————————

Try{
//code which you want to protect
}
catch(Exception type variable) {
// code which is used to handle exceptions
}
Finally/optional
{
//code which you want to execute always
}

Package in java
—————————————————————————20/07/25
——————————————————————

Package:
————-
Package is the container of classes interfaces and sub packages.

Syntax to Create Package:-


Package package name ;

Open a java code file with name MyUtil.java


Package mypack;
Public class myutil{
Public int add( int x , int,y){
Return x+y;
}
Public int greatest (int x, int y){
if(x>y){
Return x;
}
Else
{
Return your;
}
}

Command to compile Myutill.java file:-

Java interface
——————————————————————— 21/07/25
———————————————————————

INTERFACE:-
——————

Interface is a container of abstract methods and public static final


variables. Interface is used to achieve abstraction

Abstract Method :-
————————
Abstracts methods are those methods which contain only method
declearation no definition.

Interface is created by interface keyword followed by interface name.


Body of interface is enclosed within braces.within body of interface we
create abstract methods

Eg.
Interface MyInterface{
Void m1(); // public abstract void m1();
Void m2();// public abstract void m2();
}

Class TestInterface implements MyInterface {


Public void m1() {
System.out.Println(“message from m1”);
}
Public void m2 {
System.out.Println(“message from m2”);
}
}

Frame Work of Java


———————————————————————22/07/25
——————————————————————————

Programming language, software technology, Framework- A Discussion

Programming Language:-
———————————
—> Programming language provides raw materials for software
development.
—> Programming language provides syntaxes(Rules) and
semantics(Guidelines) for software development.
—> c, c++,java, c#,python..etc are popular programming language

Software Technology:-
——————————
Software Technology are non installable Software.But the software
developed by using software technology
are installable.
E.g. JDBC(Java database connectivity) is not installable but the
database driver developed by using JDBC is installable
In java JSP servlet and JDBC are software technology.

Framework:-
—————
Framework are installable software.they provide us pre designed
architecture By using frame work you can developed software more
easily. If you developed software by using software technology then you
need to write common code and
Application specific code both.but if you developed software by using
framework then you just need to write specific code only. And framework
take care of rest common code.

Framework in Diff Technology:-


——————————————
Java- spring ,spring boot ,struts ,Hibernate ,JSF(java server faces ).
Python- Django , FLask
PHP - Laravel , codeigniter, cakephp
.Net- MVC farmework

SpringBoot:-
—————-
Spring Boot is a java framework which is developed on the top of spring
framework. Spring boot framework follows MVC(Model-View-
Controller)Architecture.

Model:- Model contain database part of your application.

View:- View Contain presentation part of your application.


Controller :- contain business logic for your application.

Project Name:-
———————
1—> Agritrade Hub:-
A farmer directly sell their product to vendor / every transaction should
be recorded /

2—> Pgi virtual care:- online consultation to doctor


Doctor patient history regarding illness medical from start to end !

You might also like