SlideShare ist ein Scribd-Unternehmen logo
1 von 19
MADE BY: SHELDON ABRAHAM
IX A
38
INTRODUCTION
 Java is a computer programming
language that is concurrent, class
based object-oriented , and specifically
designed to have as few implementation
dependencies as possible.
 Java applications are typically compiled to
byte code that can run on any Java virtual
machine (JVM) regardless of computer
architecture.
 Java is, as of 2014, one of the most popular
programming languages in use, particularly for
client-server web applications, with a reported 9
million developers.
 Java was originally developed by James
Gosling at Sun Microsystems and released in
1995 as a core component of Sun
Microsystems' Java Platform.
 The language derives much of
its syntax from C and C++, but it has fewer low-
level facilities than either of them.
HISTORY
 On 23 May 1995, John Gage, the director of the Science
Office of the Sun Microsystems along with Marc Andreesen,
co-founder and executive vice president at Netscape
announced to an audience of Sun World that Java
technology wasn't a myth and that it was a reality and that it
was going to be incorporated into Netscape Navigator.
 At the time the total number of people working on Java was
less than 30. This team would shape the future in the next
decade and no one had any idea as to what was in store.
From being the mind of an unmanned vehicle on Mars to the
operating environment on most of the consumer electronics,
e.g. cable set-top boxes, VCRs, toasters and also for
personal digital assistants (PDAs). Java has come a long
way from its inception. Let's see how it all began.
 Before Java emerged as a programming
language, C++ was the dominant player in the
trade. The primary goals that the creators of
Java was to create a language that could tackle
most of the things that C++ offered while getting
rid of some of the more tedious tasks that came
with the earlier languages.
 Behind closed doors, a project was initiated in
December of 1990, whose aim was to create a
programming tool that could render obsolete
the C and C++ programming languages.
Engineer Patrick Naughton had become
extremely frustrated with the state of Sun's C++
and C APIs (Application Programming
Interfaces) and tools.
OBJECTIIVES
There were 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
PROPERTIES
 Various features of java programming language are as given below-
 1.Java is very simple programming language. Even though you have no
 programming background you can learn this language comfortably.
 2.Java is popular because it is an object oriented programming language like
C++.
 3.Platform independence is the most exciting feature of java. That means
programs in java can be executed on variety of systems. This feature is based
on the goal
“write once, run anywhere and at anytime, forever”.
 4.Java supports multithreaded programming which allows a programmer to
write
 such a program that can be perform many tasks simultaneously.
 5.Thus robustness is the essential criteria for the java programs.
 6.Java is designed for distributed systems. Hence two different objects on
different
VARIABLES
There are four kinds of variables.
 Instance variables: These are variables that are used to store the state of an object (for
example, id). Every object created from a class definition would have its own copy of the
variable. It is valid for and occupies storage for as long as the corresponding object is in
memory.
 Class variables: These variables are explicitly defined within the class-level scope with
a static modifier (for example, is Class Used). No other variables can have a
static modifier attached to them. Because these variables are defined with
the static modifier, there would always be a single copy of these variables no matter how
many times the class has been instantiated. They live as long as the class is loaded in
memory.
 Parameters or Arguments: These are variables passed into a method signature (for
example, parameter). Recall the usage of the args variable in the main method. They are
not attached to modifiers (i.e. public, private, protected or static) and they can be used
everywhere in the method. They are in memory during the execution of the method and
can't be used after the method returns.
 Local variables: These variables are defined and used specifically within the method-level
scope (for example, current Value) but not in the method signature. They do not have any
modifiers attached to it. They no longer exist after the method has returned.
OPERATORS
 Unary operators are those operators that
operate on a single variable, such as increment
and decrement (++), positive and negative signs
(+ –), the bit-wise NOT operator (~), the
logical NOT operator (!), parentheses, and the
new operator.
 Arithmetic operators are those operators used
in mathematical operations. Here it is important
to note that this table is read from left to right,
therefore multiplication and division have
greater precedence than addition and
subtraction.
 Assignment operators includes the familiar
assignment (=) operator as well as a set of
additional assignment operators referred to
generically as op= (operator equal). These new
operators are shortcut operators used when
performing an operation on a variable and
assigning the result back to that variable.
 Ternary operator is rarely used, and is mainly
inherited from Java's initial syntactical base
from C/C++. It is a somewhat cryptic shortcut,
but is perfectly legal
DECISION MAKING
If – The Conditional
 The if statement evaluates an expression and if that
evaluation is true then the specified action is taken
if ( x < 10 ) x = 10;
 If the value of x is less than 10, make x equal to 10
 It could have been written:
if ( x < 10 )
x = 10;
 Or, alternatively:
if ( x < 10 ) { x = 10; }
If… else
 The if … else statement evaluates an expression and performs one
action if that evaluation is true or a different action if it is false.
if (x != oldx) {
System.out.print(“x was changed”);
}
else {
System.out.print(“x is unchanged”);
}
Nested if … else
if ( myVal > 100 ) {
if ( remainderOn == true) {
myVal = mVal % 100;
}
else {
myVal = myVal / 100.0;
}
}
else
{
System.out.print(“myVal is in range”);
}
else if
 Useful for choosing between alternatives:
if ( n == 1 ) {
// execute code block #1
}
else if ( j == 2 ) {
// execute code block #2
}
else {
// if all previous tests have failed, execute code
block #3
}
A Warning…
WRONG!
if( i == j )
if ( j == k )
System.out.print(
“i equals k”);
else
System.out.print(
“i is not equal to j”);
CORRECT!
if( i == j ) {
if ( j == k )
System.out.print(
“i equals k”);
}
else
System.out.print(“i is not equal to j”); //
Correct!
 The switch Statement
switch ( n ) {
case 1:
// execute code block #1
break;
case 2:
// execute code block #2
break;
default:
// if all previous tests fail then
//execute code block #4
break;
}
The for loop
 Loop n times
for ( i = 0; i < n; n++ ) {
// this code body will execute n times
// ifrom 0 to n-1
}
 Nested for:
for ( j = 0; j < 10; j++ ) {
for ( i = 0; i < 20; i++ ){
// this code body will execute 200 times
}
 while loops
while(response == 1) {
System.out.print( “ID =” + userID[n]);
n++;
response = readInt( “Enter “);
}
do {… } while loops
do {
System.out.print( “ID =” + userID[n] );
n++;
response = readInt( “Enter ” );
}while (response == 1);
A break statement causes an exit from the innermost
containing while, do, for or switch statement.
for ( int i = 0; i < maxID, i++ ) {
if ( userID[i] == targetID ) {
index = i;
break;
}
} // program jumps here after break
Continue
 Can only be used with while, do or for.
 The continue statement causes the innermost loop to start the
next iteration immediately
for ( int i = 0; i < maxID; i++ ) {
if ( userID[i] != -1 ) continue;
System.out.print( “UserID ” + i + “ :” +
userID);
}
Javascript

Weitere ähnliche Inhalte

Was ist angesagt?

9781439035665 ppt ch05
9781439035665 ppt ch059781439035665 ppt ch05
9781439035665 ppt ch05Terry Yoast
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and FunctionsJake Bond
 
9781111530532 ppt ch05
9781111530532 ppt ch059781111530532 ppt ch05
9781111530532 ppt ch05Terry Yoast
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to ScalaRiccardo Cardin
 
Storage Class Specifiers in C++
Storage Class Specifiers in C++Storage Class Specifiers in C++
Storage Class Specifiers in C++Reddhi Basu
 
Python Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowPython Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowRanel Padon
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#Prasanna Kumar SM
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Raffi Khatchadourian
 
Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)Angelin R
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinarurumedina
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c languagetanmaymodi4
 

Was ist angesagt? (19)

9781439035665 ppt ch05
9781439035665 ppt ch059781439035665 ppt ch05
9781439035665 ppt ch05
 
Java unit 11
Java unit 11Java unit 11
Java unit 11
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
 
9781111530532 ppt ch05
9781111530532 ppt ch059781111530532 ppt ch05
9781111530532 ppt ch05
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to Scala
 
Loop
LoopLoop
Loop
 
Storage Class Specifiers in C++
Storage Class Specifiers in C++Storage Class Specifiers in C++
Storage Class Specifiers in C++
 
Python Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowPython Programming - III. Controlling the Flow
Python Programming - III. Controlling the Flow
 
Annotations
AnnotationsAnnotations
Annotations
 
Control statements in java programmng
Control statements in java programmngControl statements in java programmng
Control statements in java programmng
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 
Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)Exception handling & logging in Java - Best Practices (Updated)
Exception handling & logging in Java - Best Practices (Updated)
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
 

Ähnlich wie Javascript

SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
JAVA(module1).pptx
JAVA(module1).pptxJAVA(module1).pptx
JAVA(module1).pptxSRKCREATIONS
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Unit2 java
Unit2 javaUnit2 java
Unit2 javamrecedu
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using ReflectionGanesh Samarthyam
 
Basics java programing
Basics java programingBasics java programing
Basics java programingDarshan Gohel
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2Techglyphs
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Kernel Training
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Courseparveen837153
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz SAurabh PRajapati
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for MainframersRich Helton
 
Introduction
IntroductionIntroduction
Introductionrichsoden
 

Ähnlich wie Javascript (20)

SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Proyect of english
Proyect of englishProyect of english
Proyect of english
 
JAVA(module1).pptx
JAVA(module1).pptxJAVA(module1).pptx
JAVA(module1).pptx
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
Unit2 java
Unit2 javaUnit2 java
Unit2 java
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Basics java programing
Basics java programingBasics java programing
Basics java programing
 
Java 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENTJava 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENT
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java_presesntation.ppt
Java_presesntation.pptJava_presesntation.ppt
Java_presesntation.ppt
 
lecture 6
 lecture 6 lecture 6
lecture 6
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Course
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
 
Introduction
IntroductionIntroduction
Introduction
 

Kürzlich hochgeladen

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 

Kürzlich hochgeladen (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Javascript

  • 1. MADE BY: SHELDON ABRAHAM IX A 38
  • 2. INTRODUCTION  Java is a computer programming language that is concurrent, class based object-oriented , and specifically designed to have as few implementation dependencies as possible.  Java applications are typically compiled to byte code that can run on any Java virtual machine (JVM) regardless of computer architecture.
  • 3.  Java is, as of 2014, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.  Java was originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java Platform.  The language derives much of its syntax from C and C++, but it has fewer low- level facilities than either of them.
  • 4. HISTORY  On 23 May 1995, John Gage, the director of the Science Office of the Sun Microsystems along with Marc Andreesen, co-founder and executive vice president at Netscape announced to an audience of Sun World that Java technology wasn't a myth and that it was a reality and that it was going to be incorporated into Netscape Navigator.  At the time the total number of people working on Java was less than 30. This team would shape the future in the next decade and no one had any idea as to what was in store. From being the mind of an unmanned vehicle on Mars to the operating environment on most of the consumer electronics, e.g. cable set-top boxes, VCRs, toasters and also for personal digital assistants (PDAs). Java has come a long way from its inception. Let's see how it all began.
  • 5.  Before Java emerged as a programming language, C++ was the dominant player in the trade. The primary goals that the creators of Java was to create a language that could tackle most of the things that C++ offered while getting rid of some of the more tedious tasks that came with the earlier languages.  Behind closed doors, a project was initiated in December of 1990, whose aim was to create a programming tool that could render obsolete the C and C++ programming languages. Engineer Patrick Naughton had become extremely frustrated with the state of Sun's C++ and C APIs (Application Programming Interfaces) and tools.
  • 6. OBJECTIIVES There were 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
  • 7. PROPERTIES  Various features of java programming language are as given below-  1.Java is very simple programming language. Even though you have no  programming background you can learn this language comfortably.  2.Java is popular because it is an object oriented programming language like C++.  3.Platform independence is the most exciting feature of java. That means programs in java can be executed on variety of systems. This feature is based on the goal “write once, run anywhere and at anytime, forever”.  4.Java supports multithreaded programming which allows a programmer to write  such a program that can be perform many tasks simultaneously.  5.Thus robustness is the essential criteria for the java programs.  6.Java is designed for distributed systems. Hence two different objects on different
  • 8. VARIABLES There are four kinds of variables.  Instance variables: These are variables that are used to store the state of an object (for example, id). Every object created from a class definition would have its own copy of the variable. It is valid for and occupies storage for as long as the corresponding object is in memory.  Class variables: These variables are explicitly defined within the class-level scope with a static modifier (for example, is Class Used). No other variables can have a static modifier attached to them. Because these variables are defined with the static modifier, there would always be a single copy of these variables no matter how many times the class has been instantiated. They live as long as the class is loaded in memory.  Parameters or Arguments: These are variables passed into a method signature (for example, parameter). Recall the usage of the args variable in the main method. They are not attached to modifiers (i.e. public, private, protected or static) and they can be used everywhere in the method. They are in memory during the execution of the method and can't be used after the method returns.  Local variables: These variables are defined and used specifically within the method-level scope (for example, current Value) but not in the method signature. They do not have any modifiers attached to it. They no longer exist after the method has returned.
  • 9. OPERATORS  Unary operators are those operators that operate on a single variable, such as increment and decrement (++), positive and negative signs (+ –), the bit-wise NOT operator (~), the logical NOT operator (!), parentheses, and the new operator.  Arithmetic operators are those operators used in mathematical operations. Here it is important to note that this table is read from left to right, therefore multiplication and division have greater precedence than addition and subtraction.
  • 10.  Assignment operators includes the familiar assignment (=) operator as well as a set of additional assignment operators referred to generically as op= (operator equal). These new operators are shortcut operators used when performing an operation on a variable and assigning the result back to that variable.  Ternary operator is rarely used, and is mainly inherited from Java's initial syntactical base from C/C++. It is a somewhat cryptic shortcut, but is perfectly legal
  • 11. DECISION MAKING If – The Conditional  The if statement evaluates an expression and if that evaluation is true then the specified action is taken if ( x < 10 ) x = 10;  If the value of x is less than 10, make x equal to 10  It could have been written: if ( x < 10 ) x = 10;  Or, alternatively: if ( x < 10 ) { x = 10; }
  • 12. If… else  The if … else statement evaluates an expression and performs one action if that evaluation is true or a different action if it is false. if (x != oldx) { System.out.print(“x was changed”); } else { System.out.print(“x is unchanged”); } Nested if … else if ( myVal > 100 ) { if ( remainderOn == true) { myVal = mVal % 100; } else { myVal = myVal / 100.0; } } else { System.out.print(“myVal is in range”); }
  • 13. else if  Useful for choosing between alternatives: if ( n == 1 ) { // execute code block #1 } else if ( j == 2 ) { // execute code block #2 } else { // if all previous tests have failed, execute code block #3 }
  • 14. A Warning… WRONG! if( i == j ) if ( j == k ) System.out.print( “i equals k”); else System.out.print( “i is not equal to j”); CORRECT! if( i == j ) { if ( j == k ) System.out.print( “i equals k”); } else System.out.print(“i is not equal to j”); // Correct!
  • 15.  The switch Statement switch ( n ) { case 1: // execute code block #1 break; case 2: // execute code block #2 break; default: // if all previous tests fail then //execute code block #4 break; }
  • 16. The for loop  Loop n times for ( i = 0; i < n; n++ ) { // this code body will execute n times // ifrom 0 to n-1 }  Nested for: for ( j = 0; j < 10; j++ ) { for ( i = 0; i < 20; i++ ){ // this code body will execute 200 times }  while loops while(response == 1) { System.out.print( “ID =” + userID[n]); n++; response = readInt( “Enter “); }
  • 17. do {… } while loops do { System.out.print( “ID =” + userID[n] ); n++; response = readInt( “Enter ” ); }while (response == 1); A break statement causes an exit from the innermost containing while, do, for or switch statement. for ( int i = 0; i < maxID, i++ ) { if ( userID[i] == targetID ) { index = i; break; } } // program jumps here after break
  • 18. Continue  Can only be used with while, do or for.  The continue statement causes the innermost loop to start the next iteration immediately for ( int i = 0; i < maxID; i++ ) { if ( userID[i] != -1 ) continue; System.out.print( “UserID ” + i + “ :” + userID); }