Object Oriented Programming using Java..

sumanyadavdpg 20 views 16 slides Sep 24, 2024
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

Short notes on OOPs.


Slide Content

OBJECT
ORIENTED
PROGRAMMING
USING JAVA
V SEMESTER –BSC(PMCS)
DEPARTMENT OF COMPUTER SCIENCE
GOVERNMENT FIRST GRADE COLLEGE, MALUR
Dr. HAMELA K

SYLLABUS
Unit-I
IntroductiontoJAVA:JAVAEvolution:JavaHistory,JavaFeatures,HowJavaDiffersfromCandC++,Java
andInternet,JavaandWorldWideWeb,WebBrowsers,HardwareandSoftwareRequirements,Java
SupportSystems,JavaEnvironment.OverviewofJAVALanguage:Introduction,SimpleJavaprogram,
MoreofJavaStatements,ImplementingaJavaProgram,JavaVirtualMachine,CommandLine
Arguments,ProgrammingStyle.Constants,Variables,andDataTypes:Introduction,Constants,Variables,
DataTypes,DeclarationofVariables,GivingValuestoVariables,ScopeofVariables,SymbolicConstants,
TypeCasting,GettingValuesofVariables,StandardDefaultValues,OperatorsandExpressions:
Introduction,ArithmeticOperators,RelationalOperatorsLogicalOperators,AssignmentOperators,
IncrementandDecrementOperators,ConditionalOperators,BitwiseOperators,SpecialOperators,
ArithmeticExpressions,EvaluationofExpressions,ProcedenceofArithmeticOperators,TypeConversion
andAssociativity,MathematicalFunctions.DecisionMakingandBranching:Introduction,Decision
MakingwithifStatement,SimpleifStatement,Theif…..elseStatement,Nestingofif..elseStatements,
TheelseifLadder,TheSwitchStatement,The?:Operator.DecisionMakingandLooping:Introduction.
ThewhileStatement,ThedoStatement,TheforStatement,JumpsinLoopsLabeledLoops

HISTORY OF JAVA

Key Features of Java
Platform independent
Object-orientated programming language
Strongly-typed programming language
Interpreted and compiled language
Automatic memory management

Difference between c and Java
⚫1. JAVA is Object-Oriented while C is procedural. Different Paradigms, that is.
⚫C is more procedure-oriented while JAVA is data-oriented.
⚫2. Java is an Interpreted language while C is a compiled language.
⚫We all know what a compiler does. It takes your code & translates it into something the
machine can understand-that is to say-0’s & 1’s-the machine-level code. That’s exactly what
happens with our C code-it gets ‘compiled’. While with JAVA, the code is first transformed to
what is called the bytecode. This bytecode is then executed by the JVM(Java Virtual Machine).
For the same reason, JAVA code is more portable.
⚫3. C is a low-level language while JAVA is a high-level language.
⚫C is a low-level language(difficult interpretation for the user, closer significance to the machine-
level code) while JAVA is a high-level lagunage(abstracted from the machine-level details, closer
significance to the program itself).
⚫4. C uses the top-down{sharp & smooth}approach while JAVA uses the bottom-up{on the
rocks}approach.
⚫In C, formulating the program begins by defining the whole and then splitting them into smaller
elements. JAVA(and C++ and other OOP languages) follows the bottom-up approach where the
smaller elements combine together to form the whole.
⚫5. Pointer gobackstagein JAVA while C requires explicit handling of pointers.
⚫When it comes to JAVA, we don’t need the *’s & &’s to deal with pointers & their addressing.
More formally, there is no pointer syntax required in JAVA. It does what it needs to do. While in
JAVA, we do create references for objects.

C++ and JAVA
C++ JAVA
C++ supports pointers Java does not pointers
C++ run and compile using compiler which
converts source code into machine level
languages so c++ is plate from dependents
At compilation time Java Source code converts
into byte code .The interpreter execute this
byte code at run time and gives output .Java is
interpreted for the most part and hence
platform independent
c++ is depends upon operating system machine
etc
Java is platform independent language
c++ their is only compiler Java uses compiler and interpreter both
C++ supports operator overloading java does not.
Thread support is not available in Java Thread support is built-in Java
Internet support does not exist Internet support is built-in Java but not in C++.
Java does not support header file, include library
files just like C++ .
Java use import to include different Classes and
methods.
Goto statement exist in C++ There is no goto statement in Java.
operator overloading exist in c++. Java has method overloading, but no operator
overloading just like c++.
C++ support unsigned integer. Java does not support unsigned integer.

Java and Internet:
⚫Java is strongly associated with the Internet. Internet users can use
Java to create applet programs and run them locally using a "Java-
enabled browser" such as HotJava.
⚫They can also use a Java-enabled browser to download an applet
located on a computer anywhere in the Internet and run it on his
local computer.
⚫In fact, Java applets have made the Internet a true extension of the
storage system of the local computer.
⚫Internet users can also setup their websites containing java applets
that could be used by other remote users of Internet. This feature
made Java most popular programming language for Internet.

Java and WWW
•Java’s Contribution to the Internet (World Wide Web):
⚫Great feature of the java is thatjava is platform independent.
⚫It can word onany network,anyoperating systemthus making
programs more flexible.
⚫In addition tosimplifying web programming in general, Java
innovated a new type of networked program called the applet that
changed the way the online world thought about content.
⚫Portability and Security of java makesWorld wide web to spread
across globe.

www
⚫World Wide Web (WWW) is an open-ended information
retrieval system designed to be used in the Internet's
distributed environment. This system contains Web pages
that provide both information and controls. Web system is
open-ended and we can navigate to a new document in any
direction. This is made possible with the help of a language
called Hypertext MarkupLanguage (HTML). Web pages
contain HTML tags that enable us to find, retrieve,
manipulate and display documents worldwide.

Java
⚫Java was meant to be used in distributed environments such as Internet.
Since, both the Web and Java share the same philosophy, Java could be
easily incorporated into the Web system. Before Java, the World Wide
Web was limited to the display of still images and texts. However, the
incorporation of Java into Web pages has made it capable of supporting
animation, graphics, games, and a wide range of special effects.

•A. Java Applets :
⚫An applet is a special kind of Java program that is designed to be
transmitted over the Internet and automatically executed by aJava-
compatible web browser.
⚫Applet can bedownloaded on demand.
⚫Applet programs can berun on ant java compatible browser.
⚫Applets are intended to be small programs.
⚫They are typically used to display data provided by the server, handle
user input, or provide simple functions, such as a loan calculator, that
execute locally, rather than on the server.
⚫In essence, the applet allows somefunctionality to be moved from the
server to the client.

•B. Security :
⚫Applets can bedownloaded to user PC.
⚫They are executedindependently without accessing other parts of
user’s PC.
⚫The ability of Java provides security and thus Java prove itself more
secure.
•C. Portability :
⚫Java Programming is Portable.
⚫Java Program isOperating System Independent.
⚫Java Program is converted intobyte code and byte code is executed by
JVM.
⚫Java Applets are thus portable and can be downloaded from any place
in globe and can be executed on java compatible browser thus making
java programs portable.

•Five primary goals in the creation of the Java language :
⚫It should be “simple, object-oriented and familiar”.
⚫It should be “robust and secure”.
⚫It should be “architecture-neutral and portable”.
⚫It should execute with “high performance”.
⚫It should be “interpreted, threaded, and dynamic”.
Tags