OOP WITH JAVA CHAPTER 1 (NEW 2018)
OBJECT ORIENTED PROGRAMMING WITH JAVA
CHAPTER 1
Introduction
Of Java
1.1 Java
Virtual Machine (JVM).
1.2Java
Development Kit (JDK).
1.3Java
Runtime Environment(JRE).
1.4Integrated
Development Environment(IDE).
Java.
Java is a
high level language that was originally developed by sun micro system in 1995.
Java(1.0)J2SE.
Wora
Java is guranted
to write once run everywhere
1991-oak
-green
1995-java
Java
Is High Level Language
Ø Human readable.
Ø It is class based and object
oriented.
Ø Java is governed by java language
specification(JSL).
Java
Virtual Machine(JVM)
Java is an
engine that converts java bite code into machine understandable form .
Java is a
part of java runtime environment(JRE).
Phase
Of Programming Execution
1. Write code program.
2. Compiling (by java compiler)*JDK.
3. JVM executes the byte code.
JRE
(Java Runtime Environment).
JRE contains
everything that is required to run a java application which has already been
applied.
JRE is a
super set of JVM.
JRE is a
software package that is provides java class libraries along with java
virtual machine and other components to
run application written in java.
Feature
Of Java
Ø Simple
Ø object oriented
Ø portable
Ø platform independent
Ø secure
Ø high performance robust(strong)
Ø multithreaded(wed application and
multimedia application).
MULTITHREADING.
A
multithreading is like a seperate program executing concurrently.
We can write
java programme that deals with many tasks at once by defining multiple threads.
IDENTIFIER
BEST USER IN
JAVA.
JRE
•Java webstar and java plugin
•User interface tool kit
•Integration libraries
IDL.(INTERFACE DEFINIATION)
JDBC.(JAVA DATABASE CONIVITY)
JNDI.(JAVA NAMING AND DIRECTORY
INTERFACE)
RMI. (REMOTE METHOD INVOCATION
IDK.(JAVA
DEVELOPMENT KIT)
JDK 8 VERSION
|
Java
development kit is a software kit that is required to develop a java program.
In
addition tool JRE,JDK contains compiler ,debugger and java doc etc
BYTE
CODE.
The
instruction code (opcode) is just a single byte (some operations also have
parameter that follow them in the byte stream)-so there are only 256 possible
instruction.
DOWNLOAD
OF JDK
1)First of all go on web browser.
2)Then type oracle.
3)Click on java se downloads oracle.
4)Then click on downloads.
5)It will open many version.
6)You have to choose one of them which your
pc window support 32 bit or 64 bit.
7)If 32 bit then click on 32 bit version if
64 bit click on 64 bit version.
8)And click on download.
9)If download complete click ok.
DOWNLOAD
AND INSTALLATION OF JAVA NET BEAN
1)First of all go on web browser.
2)Type JAVA SE DOWNLOAD then search.
3)Then click on JAVA SE DOEWNLOAD.
4)When java se downloads you will see many
version.
5)Then click on icon of JAVA NET BEAN.
6)Then on plate form write WINDOW and
download.
7)Then file will download.
8)Download complete press OK.
9)Then press on java net beans icon it will
appear on two option RUN or CLOSE.
10)Click on RUN option.
11)And then installation screen will appear
click on NEXT.
12)Then click on ACCEPT AGREMENT.
13)Click NEXT.
14)And it will ask on which folder you have to
save you can save it on any location you want to save.
15)We save it on C LOCAL DISK on PROGRAMME
FILE. And click on next it will take time to install then click NEXT.
16)Then uncheck REGISTER NOW then finish .
17)Then open NETBEAN.
CREATING
A NEW PROJECT
Ø SELECT (JAVA) UNDER CATAGERY.
Ø SELECT (JAVA APPLICATION).
Ø CLICK (NEXT).
Ø NAME
Ø PROJECT DOC
Ø CREATE FOLDER
CLICK ON CREATE
EDITING
FILES
Ø SELECT THE FILES YOU WANT TO EDIT.
Ø EDIT THE FILES IN EDITING AREA ON THE
RIGHT
BUILDING
AND RUNNING A PROJECT
Ø CLICK THE HAMMER TO BUILD THE
MAIN PROJECT (OR PRESS 11).
DEBUGGING
CLICK LEFT
IF THE LINE NUMBER TO ADD A BREAK POINT.
A RED SEQURE
INDICATING A BREAK POINT WILL APPEAR .
DEBUGGING IS
THE PROCESS OF FINDING AND REMOVING ERRORS
IN THE PROGRAM.
Structure
of java program:.
Structure of
java program is a standard format released by java developers for the
programmer.
Ø Package.
Ø Class.
Ø Class name.
Ø Data members.
Ø User defined method.
Ø Comment.
Ø Block of statement.
Package
A package is
a collection of classes ,interfaces and subpackages
Ø Java.long.*
Class
Class is a
key word used for developing user defined data type and every java program must
start with the concept of class.
Class
name
Represent
java valid variable name each and every class in java is treated as user
defined data type.
Data members
Variable
declared inside the class are called data members and may be private or public.
Member
function
The function
declared inside the class are called members function.
Method
A java
method is collection of stetements that are ground togather to perform a
specific task .
When you
call the
System.out.println(“”);method
The system
executes the several statements.in order to display your message on screen.
Method
sum
Public
static void sum(inta,intb){
Int sum=0;
Sum=a+b;
System.out.println(“sum=”+sum);
}
}
Block
of statements
Represent a
set executable statements which contains business logic of the program.
Java
comments
Java
comments are the statements that are not
executed by the compiler comments are used to provide information about
variable,class or any statements .it can also be used to hide program code for
specific line.
This is a single line comment
Here jama =sum
Public
static void jama (inta ,intb);
Comments
Ø Single line.
Ø Multi line.
Ø Documents.
Single
line comments
It is used
to comment only line.
Multi
line comments
Comments are
used to comment more than one lines at a line.
Documents
comments
/**program=M
Asad
Date =11-09-2017
Change=update report( );/**
Variables
and operators
Identifier
Identifier
are the names of variable ,classes,package and interfaces hellow world
,args.identifier are composed of letters $,-,and numbers.
Identifier
must starts with a letter,underscore or doller sign.
Variable
A variable
is a named memory location that’s contain a value. Value may be
sound,number,text,images and other types
of data.
<data
type> variable name;
System.out.println(“hellow
pak”);
System.out
print ln(“a”+5);
Literals
A literals is
a constant value of certain type.
Final double pi=3.14;
Strongly
typed language
Ø Every variable and expressionshoud
have a type.
Ø Every typed is strictly defined.
Ø All assignment are checked for type
compactibility.
Ø No automatic type conversion for non
compactiable and conflicting data type.
Data
type in java
Java
defines of simple types
1.Byte 8bit integer type
2.Short 16
integer type
3.Int 32
integer type
4.Long 64
integer type
5.Double 64
integer type
6.Float 32 bit
integer type
7.Char symbols
8.Boolean true/false.
Byte (-128 127)
Short 2^16
Int 2^32
Long
2^64
Note(you can take notes of OOP WITH JAVA from "swedish89.wordpress.com")
Note(you can take notes of OOP WITH JAVA from "swedish89.wordpress.com")