SlideShare a Scribd company logo
Introduction to Java
Why Java?
•It’s the current “hot” language
•It’s almost entirely object-oriented
•It has a vast library of predefined objects and
operations
•It’s more platform independent
• this makes it great for Web programming
•It’s more secure
•It isn’t C++
Applets, Servlets and
Applications
•An applet is designed to be embedded in a Web
page, and run by a browser
•Applets run in a sandbox with numerous
restrictions; for example, they can’t read files
and then use the network
•A servlet is designed to be run by a web server
•An application is a conventional program
Java Virtual Machine
•The .class files generated by the compiler are not
executable binaries
• so Java combines compilation and interpretation
•Instead, they contain “byte-codes” to be executed by
the Java Virtual Machine
• other languages have done this, e.g. UCSD Pascal
•This approach provides platform independence, and
greater security
HelloWorld
• Note that String is built in
• println is a member function for the System.out class
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Comments are almost like C++
• /* This kind of comment can span
multiple lines */
• // This kind is to the end of the
line
• /**
* This kind of comment is a
special
* ‘javadoc’ style comment
*/
Primitive data types are like C
Main data types are int, double,
boolean, char
Also have byte, short, long, float
boolean has values true and false
Declarations look like C, for example,
double x, y;
int count = 0;
Expressions are like C
•Assignment statements mostly look like those in C; you
can use =, +=, *= etc.
•Arithmetic uses the familiar + - * / %
•Java also has ++ and --
•Java has boolean operators && || !
•Java has comparisons < <= == != >= >
•Java does not have pointers or pointer arithmetic
Control statements are like C
if (x < y) smaller = x;
if (x < y){ smaller=x;sum += x;}
else { smaller = y; sum += y; }
while (x < y) { y = y - x; }
do { y = y - x; } while (x < y)
for (int i = 0; i < max; i++)
sum += i;
what is a class?
•A class consists of
• a collection of fields, or variables, very much like the
named fields of a struct
• all the operations (called methods) that can be
performed on those fields
• can be instantiated
•A class describes objects and operations defined
on those objects
Name conventions
• Java is case-sensitive; maxval, maxVal, and MaxVal are three different
names
• Class names begin with a capital letter
• All other names begin with a lowercase letter
• Subsequent words are capitalized: theBigOne
• Underscores are not used in names
• These are very strong conventions!
An example of a class
class Person {
String name;
int age;
void birthday ( ) {
age++;
System.out.println (name + ' is
now ' + age);
}
}
Creating and using an object
•Person john;
john = new Person ( );
john.name = "John Smith";
john.age = 37;
•Person mary = new Person ( );
mary.name = "Mary Brown";
mary.age = 33;
mary.birthday ( );
An array is an object
• Person mary = new Person ( );
• int myArray[ ] = new int[5];
• or:
• int myArray[ ] = {1, 4, 9, 16, 25};
• String languages [ ] = {"Prolog", "Java"};
Ad

More Related Content

What's hot (15)

Learn VB.NET at ASIT
Learn VB.NET at ASITLearn VB.NET at ASIT
Learn VB.NET at ASIT
ASIT
 
Uklug2012 yellow and blue stream
Uklug2012 yellow and blue streamUklug2012 yellow and blue stream
Uklug2012 yellow and blue stream
Frank van der Linden
 
Cetpa dotnet taining
Cetpa dotnet tainingCetpa dotnet taining
Cetpa dotnet taining
sharmamohan13989
 
Stairway to scala flyer
Stairway to scala flyerStairway to scala flyer
Stairway to scala flyer
dickwall
 
Building reactive systems with Akka
Building reactive systems with AkkaBuilding reactive systems with Akka
Building reactive systems with Akka
Kristof Jozsa
 
U2A2
U2A2U2A2
U2A2
pfefferteacher
 
U2A3
U2A3U2A3
U2A3
pfefferteacher
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
Ngoc Dao
 
Ceylon introduction by Stéphane Épardaud
Ceylon introduction by Stéphane ÉpardaudCeylon introduction by Stéphane Épardaud
Ceylon introduction by Stéphane Épardaud
UnFroMage
 
Ceylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudCeylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane Épardaud
UnFroMage
 
Use notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages developmentUse notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages development
Frank van der Linden
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
Saket Khopkar
 
Java Tutorial Lab 3
Java Tutorial Lab 3Java Tutorial Lab 3
Java Tutorial Lab 3
Berk Soysal
 
Java Tutorial Lab 6
Java Tutorial Lab 6Java Tutorial Lab 6
Java Tutorial Lab 6
Berk Soysal
 
Learn VB.NET at ASIT
Learn VB.NET at ASITLearn VB.NET at ASIT
Learn VB.NET at ASIT
ASIT
 
Stairway to scala flyer
Stairway to scala flyerStairway to scala flyer
Stairway to scala flyer
dickwall
 
Building reactive systems with Akka
Building reactive systems with AkkaBuilding reactive systems with Akka
Building reactive systems with Akka
Kristof Jozsa
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
Ngoc Dao
 
Ceylon introduction by Stéphane Épardaud
Ceylon introduction by Stéphane ÉpardaudCeylon introduction by Stéphane Épardaud
Ceylon introduction by Stéphane Épardaud
UnFroMage
 
Ceylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane ÉpardaudCeylon SDK by Stéphane Épardaud
Ceylon SDK by Stéphane Épardaud
UnFroMage
 
Use notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages developmentUse notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages development
Frank van der Linden
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
Saket Khopkar
 
Java Tutorial Lab 3
Java Tutorial Lab 3Java Tutorial Lab 3
Java Tutorial Lab 3
Berk Soysal
 
Java Tutorial Lab 6
Java Tutorial Lab 6Java Tutorial Lab 6
Java Tutorial Lab 6
Berk Soysal
 

Similar to Introduction to java programming (20)

Java programmingjsjdjdjdjdjdjdjdjdiidiei
Java programmingjsjdjdjdjdjdjdjdjdiidieiJava programmingjsjdjdjdjdjdjdjdjdiidiei
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
Java01
Java01Java01
Java01
mosewoodward24
 
Java01
Java01Java01
Java01
Sanjeev Tripathi
 
Java01
Java01Java01
Java01
mosewoodward24
 
Java01
Java01Java01
Java01
Prakash Mani
 
Java Simple Introduction in single course
Java Simple Introduction in single courseJava Simple Introduction in single course
Java Simple Introduction in single course
binzbinz3
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyftjava01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
vibrantuser
 
Java01
Java01Java01
Java01
Dhaval Patel
 
java ppt for basic intro about java and its
java ppt for basic intro about java and itsjava ppt for basic intro about java and its
java ppt for basic intro about java and its
kssandhu875
 
Present the syntax of Java Introduce the Java
Present the syntax of Java Introduce the JavaPresent the syntax of Java Introduce the Java
Present the syntax of Java Introduce the Java
ssuserfd620b
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
FakeBuddy2
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
ssuser73c6451
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
ShivamChaturvedi67
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
ROGNationYT
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
JyoGen
 
mukul Dubey.pptx
mukul Dubey.pptxmukul Dubey.pptx
mukul Dubey.pptx
CodeHome
 
OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
BabekEsedli
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
SouravGhosh305827
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
Java programmingjsjdjdjdjdjdjdjdjdiidieiJava programmingjsjdjdjdjdjdjdjdjdiidiei
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
Java Simple Introduction in single course
Java Simple Introduction in single courseJava Simple Introduction in single course
Java Simple Introduction in single course
binzbinz3
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyftjava01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
vibrantuser
 
java ppt for basic intro about java and its
java ppt for basic intro about java and itsjava ppt for basic intro about java and its
java ppt for basic intro about java and its
kssandhu875
 
Present the syntax of Java Introduce the Java
Present the syntax of Java Introduce the JavaPresent the syntax of Java Introduce the Java
Present the syntax of Java Introduce the Java
ssuserfd620b
 
java01.ppt
java01.pptjava01.ppt
java01.ppt
JyoGen
 
mukul Dubey.pptx
mukul Dubey.pptxmukul Dubey.pptx
mukul Dubey.pptx
CodeHome
 
OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
Ad

More from ASIT Education (20)

COMMON PROBLEMS FACING WITH TABLETS
COMMON PROBLEMS FACING WITH TABLETSCOMMON PROBLEMS FACING WITH TABLETS
COMMON PROBLEMS FACING WITH TABLETS
ASIT Education
 
Simple hardware problems facing in pc's
Simple hardware problems facing in pc'sSimple hardware problems facing in pc's
Simple hardware problems facing in pc's
ASIT Education
 
Amc square IT services
Amc square IT servicesAmc square IT services
Amc square IT services
ASIT Education
 
learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.
ASIT Education
 
Learn my sql at amc square learning
Learn my sql at amc square learningLearn my sql at amc square learning
Learn my sql at amc square learning
ASIT Education
 
Learn joomla at amc square learning
Learn joomla at amc square learningLearn joomla at amc square learning
Learn joomla at amc square learning
ASIT Education
 
learn ANDROID at AMC Square Learning
learn ANDROID at AMC Square Learninglearn ANDROID at AMC Square Learning
learn ANDROID at AMC Square Learning
ASIT Education
 
Learn spring at amc square learning
Learn spring at amc square learningLearn spring at amc square learning
Learn spring at amc square learning
ASIT Education
 
Learn cpp at amc square learning
Learn cpp at amc square learningLearn cpp at amc square learning
Learn cpp at amc square learning
ASIT Education
 
Learn perl in amc square learning
Learn perl in amc square learningLearn perl in amc square learning
Learn perl in amc square learning
ASIT Education
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learning
ASIT Education
 
Learn Ruby Programming in Amc Square Learning
Learn Ruby Programming in Amc Square LearningLearn Ruby Programming in Amc Square Learning
Learn Ruby Programming in Amc Square Learning
ASIT Education
 
learn sharepoint at AMC Square learning
learn sharepoint at AMC Square learninglearn sharepoint at AMC Square learning
learn sharepoint at AMC Square learning
ASIT Education
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
ASIT Education
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.ppt
ASIT Education
 
Ruby programming introduction
Ruby programming introductionRuby programming introduction
Ruby programming introduction
ASIT Education
 
Introduction to vm ware
Introduction to vm wareIntroduction to vm ware
Introduction to vm ware
ASIT Education
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
ASIT Education
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
ASIT Education
 
Introduction to internet
Introduction to internetIntroduction to internet
Introduction to internet
ASIT Education
 
COMMON PROBLEMS FACING WITH TABLETS
COMMON PROBLEMS FACING WITH TABLETSCOMMON PROBLEMS FACING WITH TABLETS
COMMON PROBLEMS FACING WITH TABLETS
ASIT Education
 
Simple hardware problems facing in pc's
Simple hardware problems facing in pc'sSimple hardware problems facing in pc's
Simple hardware problems facing in pc's
ASIT Education
 
Amc square IT services
Amc square IT servicesAmc square IT services
Amc square IT services
ASIT Education
 
learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.
ASIT Education
 
Learn my sql at amc square learning
Learn my sql at amc square learningLearn my sql at amc square learning
Learn my sql at amc square learning
ASIT Education
 
Learn joomla at amc square learning
Learn joomla at amc square learningLearn joomla at amc square learning
Learn joomla at amc square learning
ASIT Education
 
learn ANDROID at AMC Square Learning
learn ANDROID at AMC Square Learninglearn ANDROID at AMC Square Learning
learn ANDROID at AMC Square Learning
ASIT Education
 
Learn spring at amc square learning
Learn spring at amc square learningLearn spring at amc square learning
Learn spring at amc square learning
ASIT Education
 
Learn cpp at amc square learning
Learn cpp at amc square learningLearn cpp at amc square learning
Learn cpp at amc square learning
ASIT Education
 
Learn perl in amc square learning
Learn perl in amc square learningLearn perl in amc square learning
Learn perl in amc square learning
ASIT Education
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learning
ASIT Education
 
Learn Ruby Programming in Amc Square Learning
Learn Ruby Programming in Amc Square LearningLearn Ruby Programming in Amc Square Learning
Learn Ruby Programming in Amc Square Learning
ASIT Education
 
learn sharepoint at AMC Square learning
learn sharepoint at AMC Square learninglearn sharepoint at AMC Square learning
learn sharepoint at AMC Square learning
ASIT Education
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
ASIT Education
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.ppt
ASIT Education
 
Ruby programming introduction
Ruby programming introductionRuby programming introduction
Ruby programming introduction
ASIT Education
 
Introduction to vm ware
Introduction to vm wareIntroduction to vm ware
Introduction to vm ware
ASIT Education
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
ASIT Education
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
ASIT Education
 
Introduction to internet
Introduction to internetIntroduction to internet
Introduction to internet
ASIT Education
 
Ad

Recently uploaded (20)

Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 

Introduction to java programming

  • 2. Why Java? •It’s the current “hot” language •It’s almost entirely object-oriented •It has a vast library of predefined objects and operations •It’s more platform independent • this makes it great for Web programming •It’s more secure •It isn’t C++
  • 3. Applets, Servlets and Applications •An applet is designed to be embedded in a Web page, and run by a browser •Applets run in a sandbox with numerous restrictions; for example, they can’t read files and then use the network •A servlet is designed to be run by a web server •An application is a conventional program
  • 4. Java Virtual Machine •The .class files generated by the compiler are not executable binaries • so Java combines compilation and interpretation •Instead, they contain “byte-codes” to be executed by the Java Virtual Machine • other languages have done this, e.g. UCSD Pascal •This approach provides platform independence, and greater security
  • 5. HelloWorld • Note that String is built in • println is a member function for the System.out class public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
  • 6. Comments are almost like C++ • /* This kind of comment can span multiple lines */ • // This kind is to the end of the line • /** * This kind of comment is a special * ‘javadoc’ style comment */
  • 7. Primitive data types are like C Main data types are int, double, boolean, char Also have byte, short, long, float boolean has values true and false Declarations look like C, for example, double x, y; int count = 0;
  • 8. Expressions are like C •Assignment statements mostly look like those in C; you can use =, +=, *= etc. •Arithmetic uses the familiar + - * / % •Java also has ++ and -- •Java has boolean operators && || ! •Java has comparisons < <= == != >= > •Java does not have pointers or pointer arithmetic
  • 9. Control statements are like C if (x < y) smaller = x; if (x < y){ smaller=x;sum += x;} else { smaller = y; sum += y; } while (x < y) { y = y - x; } do { y = y - x; } while (x < y) for (int i = 0; i < max; i++) sum += i;
  • 10. what is a class? •A class consists of • a collection of fields, or variables, very much like the named fields of a struct • all the operations (called methods) that can be performed on those fields • can be instantiated •A class describes objects and operations defined on those objects
  • 11. Name conventions • Java is case-sensitive; maxval, maxVal, and MaxVal are three different names • Class names begin with a capital letter • All other names begin with a lowercase letter • Subsequent words are capitalized: theBigOne • Underscores are not used in names • These are very strong conventions!
  • 12. An example of a class class Person { String name; int age; void birthday ( ) { age++; System.out.println (name + ' is now ' + age); } }
  • 13. Creating and using an object •Person john; john = new Person ( ); john.name = "John Smith"; john.age = 37; •Person mary = new Person ( ); mary.name = "Mary Brown"; mary.age = 33; mary.birthday ( );
  • 14. An array is an object • Person mary = new Person ( ); • int myArray[ ] = new int[5]; • or: • int myArray[ ] = {1, 4, 9, 16, 25}; • String languages [ ] = {"Prolog", "Java"};