SlideShare uma empresa Scribd logo
1 de 16
Introduction to
Java
CST200 – Week 1: Introduction to Java
Instructor: Andreea Molnar
Outline
• Aims
• Basic Concepts
• Strings
• Arrays
Aim
• The aim of this presentation is to

emphasis on some of the material
covered by the pluralsigh videos.
Basic Concepts
• Expression: see more about them here:

http://www.d.umn.edu/~gshute/java/stat
ements.html

• Algorithm: see a definition here:

http://en.wikipedia.org/wiki/Algorithm
Strings and Arrays
The first letter of a String is at the
position 0 and the first value of an array
is at the position 0.
Strings
Any sequence of characters, for example:
String s = “Arizona”;
String s = “1457 Mesa”;
String s = “@u”;
Strings - Methods
You can find all the String methods at:
http://docs.oracle.com/javase/7/docs/api/j
ava/lang/String.html
Strings - Methods
public int length() – returns the length of
the string
String s = “CST 200”;
s.length() – will return 7 as there are 7
characters in the string
Strings - Methods
public int length() – returns the length of 
the string
String s = “CST 200”;
s.length() – will return 7 as there are 7 
characters in the string (space is count as 
a separate character)
Strings - Methods
public char charAt(int index)– returns the 
character value at the specified index
String s = “CST 200”;
C

T

0

index

S
1

2

2
3

0

0

4

5

6
Strings - Methods
public char charAt(int index)– returns the 
character value at the specified index
String s = “CST 200”;
C

S

T

0

1

2

2
3

0

0

4

5

6

The first character of a String is at the 
position 0!!!
Strings - Methods
String s = “CST 200”;
C

S

T

0

1

2

2
3

0

0

4

5

6

System.out.println(s.charAt(0));//will print C
System.out.println(s.charAt(6));//will print 0 
Strings - Methods
public int indexOf(String str) - returns the
index within this string of the first
occurrence of the specified substring
String s = “CST 200”;
C

S

T

0

1

2

2
3

0

0

4

5

6

System.out.println(s.indexOf(“T”));
//will print 3
Arrays
Array is a container that holds a fixed
number of values.
int[] array = {10, 20, 30, 50};
10

20

30

50

0

2

3

4

index
Arrays
int[] array = {10, 20, 30, 50};
10

20

30

50

0

1

2

3

To print the values of this array:
System.out.println(array[0]);//will print 10
System.out.println(array[1]);//will print 20
System.out.println(array[2]);//will print 30
Summary
• Expression definition
• Algorithm definition
• The first character of an array starts at
position 0

• The first element of an array starts at
the position 0

Mais conteúdo relacionado

Semelhante a Introduction to java

cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
mshanajoel6
 
Common errors v2
Common errors v2Common errors v2
Common errors v2
ASU Online
 

Semelhante a Introduction to java (20)

String.pptx
String.pptxString.pptx
String.pptx
 
1_5_Python_to_Java.pptx
1_5_Python_to_Java.pptx1_5_Python_to_Java.pptx
1_5_Python_to_Java.pptx
 
02-Basic-Java-Syntax.pdf
02-Basic-Java-Syntax.pdf02-Basic-Java-Syntax.pdf
02-Basic-Java-Syntax.pdf
 
How to start learning java
How to start learning javaHow to start learning java
How to start learning java
 
cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
 
JavaBasicsCore1.ppt
JavaBasicsCore1.pptJavaBasicsCore1.ppt
JavaBasicsCore1.ppt
 
7. Multithreading
7. Multithreading7. Multithreading
7. Multithreading
 
Multi threading
Multi threadingMulti threading
Multi threading
 
Lecture Notes
Lecture NotesLecture Notes
Lecture Notes
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Java Course — Mastering the Fundamentals
Java Course — Mastering the FundamentalsJava Course — Mastering the Fundamentals
Java Course — Mastering the Fundamentals
 
java01.pdf
java01.pdfjava01.pdf
java01.pdf
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Core java concepts
Core java conceptsCore java concepts
Core java concepts
 
Common errors v2
Common errors v2Common errors v2
Common errors v2
 
GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)
 
Strings and common operations
Strings and common operationsStrings and common operations
Strings and common operations
 
Strings in java
Strings in javaStrings in java
Strings in java
 
1st.pptx
1st.pptx1st.pptx
1st.pptx
 
Introduction To Java.
Introduction To Java.Introduction To Java.
Introduction To Java.
 

Mais de ASU Online

Midterm common mistakes
Midterm common mistakesMidterm common mistakes
Midterm common mistakes
ASU Online
 
Lists, queues and stacks 1
Lists, queues and stacks 1Lists, queues and stacks 1
Lists, queues and stacks 1
ASU Online
 
Lists, queues and stacks
Lists, queues and stacksLists, queues and stacks
Lists, queues and stacks
ASU Online
 
Classes revision
Classes revisionClasses revision
Classes revision
ASU Online
 
For loop java 2
For loop java 2For loop java 2
For loop java 2
ASU Online
 
Reading and writting v2
Reading and writting v2Reading and writting v2
Reading and writting v2
ASU Online
 
Common missunderestandings
Common missunderestandingsCommon missunderestandings
Common missunderestandings
ASU Online
 
Lecture 14 tourism in europe
Lecture 14   tourism in europeLecture 14   tourism in europe
Lecture 14 tourism in europe
ASU Online
 
Lecture 13 tourism in the south pacific
Lecture 13   tourism in the south pacificLecture 13   tourism in the south pacific
Lecture 13 tourism in the south pacific
ASU Online
 
Lecture 12 tourism in australia and new zealand
Lecture 12   tourism in australia and new zealandLecture 12   tourism in australia and new zealand
Lecture 12 tourism in australia and new zealand
ASU Online
 
Lecture 11 tourism in east asia
Lecture 11   tourism in east asiaLecture 11   tourism in east asia
Lecture 11 tourism in east asia
ASU Online
 
Lecture 9 tourism in south asia
Lecture 9   tourism in south asiaLecture 9   tourism in south asia
Lecture 9 tourism in south asia
ASU Online
 
Lecture 9 tourism in south asia-1
Lecture 9   tourism in south asia-1Lecture 9   tourism in south asia-1
Lecture 9 tourism in south asia-1
ASU Online
 
Lecture 8 tourism in central asia
Lecture 8   tourism in central asiaLecture 8   tourism in central asia
Lecture 8 tourism in central asia
ASU Online
 
Lecture 7 tourism in the middle east and north africa
Lecture 7   tourism in the middle east and north africaLecture 7   tourism in the middle east and north africa
Lecture 7 tourism in the middle east and north africa
ASU Online
 
Lecture 6 tourism in sub-saharan africa
Lecture 6   tourism in sub-saharan africaLecture 6   tourism in sub-saharan africa
Lecture 6 tourism in sub-saharan africa
ASU Online
 
Lecture 5 tourism in latin america
Lecture 5   tourism in latin americaLecture 5   tourism in latin america
Lecture 5 tourism in latin america
ASU Online
 
Lecture 4 tourism in the caribbean
Lecture 4   tourism in the caribbeanLecture 4   tourism in the caribbean
Lecture 4 tourism in the caribbean
ASU Online
 
Lecture 3 political context of international tourism
Lecture 3   political context of international tourismLecture 3   political context of international tourism
Lecture 3 political context of international tourism
ASU Online
 
Lecture 2 impacts of tourism global dist
Lecture 2 impacts of tourism   global distLecture 2 impacts of tourism   global dist
Lecture 2 impacts of tourism global dist
ASU Online
 

Mais de ASU Online (20)

Midterm common mistakes
Midterm common mistakesMidterm common mistakes
Midterm common mistakes
 
Lists, queues and stacks 1
Lists, queues and stacks 1Lists, queues and stacks 1
Lists, queues and stacks 1
 
Lists, queues and stacks
Lists, queues and stacksLists, queues and stacks
Lists, queues and stacks
 
Classes revision
Classes revisionClasses revision
Classes revision
 
For loop java 2
For loop java 2For loop java 2
For loop java 2
 
Reading and writting v2
Reading and writting v2Reading and writting v2
Reading and writting v2
 
Common missunderestandings
Common missunderestandingsCommon missunderestandings
Common missunderestandings
 
Lecture 14 tourism in europe
Lecture 14   tourism in europeLecture 14   tourism in europe
Lecture 14 tourism in europe
 
Lecture 13 tourism in the south pacific
Lecture 13   tourism in the south pacificLecture 13   tourism in the south pacific
Lecture 13 tourism in the south pacific
 
Lecture 12 tourism in australia and new zealand
Lecture 12   tourism in australia and new zealandLecture 12   tourism in australia and new zealand
Lecture 12 tourism in australia and new zealand
 
Lecture 11 tourism in east asia
Lecture 11   tourism in east asiaLecture 11   tourism in east asia
Lecture 11 tourism in east asia
 
Lecture 9 tourism in south asia
Lecture 9   tourism in south asiaLecture 9   tourism in south asia
Lecture 9 tourism in south asia
 
Lecture 9 tourism in south asia-1
Lecture 9   tourism in south asia-1Lecture 9   tourism in south asia-1
Lecture 9 tourism in south asia-1
 
Lecture 8 tourism in central asia
Lecture 8   tourism in central asiaLecture 8   tourism in central asia
Lecture 8 tourism in central asia
 
Lecture 7 tourism in the middle east and north africa
Lecture 7   tourism in the middle east and north africaLecture 7   tourism in the middle east and north africa
Lecture 7 tourism in the middle east and north africa
 
Lecture 6 tourism in sub-saharan africa
Lecture 6   tourism in sub-saharan africaLecture 6   tourism in sub-saharan africa
Lecture 6 tourism in sub-saharan africa
 
Lecture 5 tourism in latin america
Lecture 5   tourism in latin americaLecture 5   tourism in latin america
Lecture 5 tourism in latin america
 
Lecture 4 tourism in the caribbean
Lecture 4   tourism in the caribbeanLecture 4   tourism in the caribbean
Lecture 4 tourism in the caribbean
 
Lecture 3 political context of international tourism
Lecture 3   political context of international tourismLecture 3   political context of international tourism
Lecture 3 political context of international tourism
 
Lecture 2 impacts of tourism global dist
Lecture 2 impacts of tourism   global distLecture 2 impacts of tourism   global dist
Lecture 2 impacts of tourism global dist
 

Último

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Introduction to java