Sunteți pe pagina 1din 7

Object Oriented Programming

Object Technology Concepts


What is Object Technology?
Object Technology is developing software based on objects.
Object - combination of data and function.
Procedural or structural programming focused mainly on functions.
-Data and functions were considered separately.

What Object Technology IS NOT!


-Just another programming language.
-A silver bullet
-A flash in the pan
-Magic
The focus of procedural programming is to break down a programming task into a
collection of variables, data structures, and subroutines, whereas in object-oriented
programming it is to break down a programming task into classes with each "class"
encapsulating its own methods (subroutines). The most important distinction is whereas
procedural programming uses procedures to operate on data structures, object-oriented
programming bundles the two together so an "object", which is an instance of a class,
operates on its "own" data structure.

The difference between Procedural and Objects:


Procedural - A programming language that requires programming discipline.
data and function are considered separately. There is no common way to access
data could be enforced easily.
Objects data and function are combined. The use of an object requires knowledge
of the function names. Objects are key to understanding object-oriented technology.
Look around right now and you'll find many examples of real-world objects: your dog,
your desk, your television set, your bicycle.

In terms of Re-use
Procedural hard to identify reusable code opportunities because of the lack of
encapsulation.
Objects There is the re-use of code

Why Object Technology?


-A natural way of thinking
-Ability to support change

OOP is a programming methodology that views a program as similarly


consisting of objects that interact with one another by means of action.
OOP is a software development methodology in which a program is
conceptualized as a group of objects that work together. The biggest
challenge for a new Java Programmer is learning OOP at the same time as
Java Language. OOP is an approach to building computer programs that
mimics how objects are assembled in physical world.
An Object is a thing both tangible and intangible that you can
imagine. A program written in object oriented style will consist of interacting
objects. It is a program construction that has data (or information) associated
with it and that can perform certain actions. When a program is run, the
objects interact with one another in order to accomplish whatever the
program is designed to do.
Methods The actions performed by objects.
Class is a type or kind of object. All objects in the same class have the
same kinds of data and the same methods.

What is Java?
An object-oriented programming language developed at SUN Microsystems.
A set of standardized Class Libraries (packages) that support predefined reusable
functionality. Has virtual machine that can be embedded in Web browsers and Operating
System.

Java [slang for "coffee"] is kind of a streamlined version of C++, designed for
portability. Its key advantage is that Java programs can be run on any operating system for
which a Java "virtual environment" is available. (Programs in most other languages have to
be modified and recompiled to go from one OS to another.)
Aims of Java
1.
2.
3.
4.
5.

Object -Orientation
Portability
Performance
Security
Internationalization

Java Virtual Machine (JVM)


A self contained environment that acts as if it is a separate computer.

Java Technologies
Application a stand alone Java program that runs via the java command with no
security restrictions, and contains a main method.
Applets webpage applications that require a Web browsers, has a limited access rights
to a client.
Servlets sever side application, set of HTML pages that interacts with the user then
sends collected data to the servlet to be processed
JSPs server (Java Server Pages) Server side application, HTML page with special
embedded tags which determine the actual content of the HTML at the time of its
delivering to the client.
EJBs (Enterprise Java Beans) framework for creating extensible, scalable, object
oriented systems.

Java Development Cycle

Java
Source

javac

.java

Java
Bytecode

.class

java

JVM

JVM

JVM

Windows

Linux

Unix

Java Keywords

abstract

defaultif

private

this

boolean

do

implements

protected

break

double

Import

byte

else

instanceof

return

transient

case

extends

int

short

try

catch

final

interface

static

void

char

finally

long

strctfp

volatile

class

float

native

super

while

const

for

new

switch

continue

goto

package

synchronized

throw

public

throws

Java 8 Primitive Data Types

Variable a place where information can be stored while a program is running. The value
can be changed at any point in the program.
Operators

Type
name

Description

byte

Integer

[]

Array index

short

Integer

++

Increment

int

Integer

--

Decrement

long

Integer

Positive

float

Real number

Negative

double

Real number

Not

char

16 bit
Unicode
character

Multiplied

Divided

Boolean
true/false

Remainder

Added

Subtracted

==

Is equal to

!=

Not equal to

&&

AND

||

OR

boolean

Operator

Escape Characters

Double

Single

\\

Descriptio
n

quote
quote
Backslash

\n

New line

\t

Tab

//

Add Comment

Brief History of Java


Project Green was started and needed a language for software development
1991 Java was first developed and called Oak, later changed to Java for copyright reasons
1992 release of the first product called7 intelligent remote control
1993-1994 selling and no buyers
1994 Development of Hot Java
1996(early) first version of Java was released 1.02
1996(late) much better version 1.1
1998 Version 1.2 with new GUI support (now called Java2)

Java Basic Syntax


About Java programs, it is very important to keep in mind the following points.

Case Sensitivity - Java is case sensitive, which means


identifier Hello and hello would have different meaning in Java.

Class Names - For all class names the first letter should be in Upper Case.
If several words are used to form a name of the class, each inner word's first letter should be
in Upper Case.
Example class MyFirstJavaClass

Method Names - All method names should start with a Lower Case letter.
If several words are used to form the name of the method, then each inner word's first letter
should be in Upper Case.
Example public void myMethodName()

Program File Name - Name of the program file should exactly match the class
name.
When saving the file, you should save it using the class name (Remember Java is case
sensitive) and append '.java' to the end of the name (if the file name and the class name do
not match your program will not compile).
Example : Assume 'MyFirstJavaProgram' is the class name. Then the file should be saved
as'MyFirstJavaProgram.java'

public static void main(String args[]) - Java program processing starts from the
main() method which is a mandatory part of every Java program..

Java Identifiers
All Java components require names. Names used for classes, variables and methods are
called identifiers.
In Java, there are several points to remember about identifiers. They are as follows:

All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an
underscore (_).
After the first character identifiers can have any combination of characters.
A key word cannot be used as an identifier.
Most importantly identifiers are case sensitive.
Examples of legal identifiers: age, $salary, _value, __1_value
Examples of illegal identifiers: 123abc, -salary

S-ar putea să vă placă și