SlideShare ist ein Scribd-Unternehmen logo
1 von 16
JAVA
Stuff about Java
• Programming language
• Runs on a “virtual machine” (JVM)
• Platform Independent (Can run on any
machine)
• Object Oriented Language
• Automatic Garbage Collection
DATA TYPES
• boolean: Truth value (true or
false).
• int: Integer (0, 1, -47).
• double: Real number (3.14,
1.0, -2.1).
• String: Text (“hello world”).
Declaring and Assigning
Variables
Form: Type name;
Examples:
• String me = “Kenny”;
• int x = 4;
• double y;
Operators
• Assignment: =
• Addition: +
• Subtraction: • Multiplication: *
• Division: /
Form: varName Op varName;
Order of Operation follow
standard rules
Methods
Form: modifiers return_type name(arguments){
statements

}

To Call:
name(arguments);
Examples: public static void myMethod(int arg){
int x = 4
}
public static void myMethod(int arg){
int x = 4
return x;
}
if and “else if” Statement
Form: If (condition){
}
Example: if(x < 4){

System.out.println(“x is less than 4”);
} else if(x > 4){
System.out.println(“x is greater than 4”);
} else{
System.out.println(“x must be equal to 4”);
}
COMPARISON OPERATORS
•
•
•
•
•
•

x > y: x is greater than y
x < y: x is less than y
x >= y: x is greater than or equal to x
x <= y: x is less than or equal to y
x == y: x equals y
( equality: ==, assignment: = )
Boolean Operators
• &&: logical AND
return true if true
• ||: logical OR
returns false if false
Example: if ( x > 6 && x < 9)
Loops
Loops

Information

while

Runs while condition is true
While(x < 4){
dostuff();
}

do … while

Runs for the first time without checking then runs
while condition is true
do{
Stuff();
}while(x < 4);

For

Runs with optional counter while condition is true
For(int I = 0; I < 4, x < 4; i++){
doStuff();
}
Arrays
•
•
•
•

An indexed list of values
Any data type
All elements must have the same type
Form: type[] name = { val1, val2, val3 }; OR
type[ ] name = new type[noOfValues];

Int [] a = { 3, 5, 6, 8, 11, 12, 15, 17, 19, 20 }
Value:
Index:

a[0] a[1]

a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]

System.out.println(a[5]);

output: 12
Classes
To model real world problems
// little baby 1
String name1;double weight1;
// little baby2
String name2;double weight2;
// little baby 3
String name3;double weight3;

For 500 babies inefficient!!!
• Using Classes
 Create a class Baby
 Then an array of baby or
babies
public class Baby {
String name;
boolean isMale;
double weight;
double decibels;
}
Baby[] babies = new Baby[500];
•

Classes can also contain methods

public class Baby {
…
Eat()
{
weight += 1;
}
}
Inheritance
• When a class inherits another class it has the
characteristics of that class plus its own.
• Classes inherit from one class
• Example: A class Car can inherit from another
class vehicle.
• Form: modifier class className extends baseClass {
}
Interfaces
• Interfaces are like classes that cannot have
object instances assigned.
• They can only be implemented by classes.
• Classes can implement many interfaces.
• Example:
interface move {
void accelerate();
void speed();
}
QUESTIONS?

Weitere ähnliche Inhalte

Was ist angesagt?

C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
Rishikesh Agrawani
 
Zhongl scala summary
Zhongl scala summaryZhongl scala summary
Zhongl scala summary
lunfu zhong
 
Pavel kravchenko obj c runtime
Pavel kravchenko obj c runtimePavel kravchenko obj c runtime
Pavel kravchenko obj c runtime
DneprCiklumEvents
 

Was ist angesagt? (20)

Concept of constructors
Concept of constructorsConcept of constructors
Concept of constructors
 
Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3
 
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
 
Scala jargon cheatsheet
Scala jargon cheatsheetScala jargon cheatsheet
Scala jargon cheatsheet
 
Object Class
Object Class Object Class
Object Class
 
Java
JavaJava
Java
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
 
Zhongl scala summary
Zhongl scala summaryZhongl scala summary
Zhongl scala summary
 
Js training
Js trainingJs training
Js training
 
Session 08 - OOP with Java - continued
Session 08 - OOP with Java - continuedSession 08 - OOP with Java - continued
Session 08 - OOP with Java - continued
 
Python internals and how they affect your code - kasra ahmadvand
Python internals and how they affect your code - kasra ahmadvandPython internals and how they affect your code - kasra ahmadvand
Python internals and how they affect your code - kasra ahmadvand
 
C++ Template
C++ TemplateC++ Template
C++ Template
 
Head First Java Chapter 1
Head First Java Chapter 1Head First Java Chapter 1
Head First Java Chapter 1
 
Lesson11
Lesson11Lesson11
Lesson11
 
Intro to kotlin 2018
Intro to kotlin 2018Intro to kotlin 2018
Intro to kotlin 2018
 
Pavel kravchenko obj c runtime
Pavel kravchenko obj c runtimePavel kravchenko obj c runtime
Pavel kravchenko obj c runtime
 
4.trasformers filters-adapters
4.trasformers filters-adapters4.trasformers filters-adapters
4.trasformers filters-adapters
 
Session 05 cleaning and exploring
Session 05 cleaning and exploringSession 05 cleaning and exploring
Session 05 cleaning and exploring
 
JavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft TrainingJavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft Training
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 

Andere mochten auch (6)

Rf.cwla5 s11.1
Rf.cwla5 s11.1Rf.cwla5 s11.1
Rf.cwla5 s11.1
 
PDQ Programming Languages plus an overview of Alice - Frank Ducrest
PDQ Programming Languages plus an overview of Alice - Frank DucrestPDQ Programming Languages plus an overview of Alice - Frank Ducrest
PDQ Programming Languages plus an overview of Alice - Frank Ducrest
 
Assessment document new
Assessment document newAssessment document new
Assessment document new
 
Neno/Fhat: Semantic Network Programming Language and Virtual Machine Specific...
Neno/Fhat: Semantic Network Programming Language and Virtual Machine Specific...Neno/Fhat: Semantic Network Programming Language and Virtual Machine Specific...
Neno/Fhat: Semantic Network Programming Language and Virtual Machine Specific...
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 

Ähnlich wie An Overview of the Java Programming Language

LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript core
Web Zhao
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
HCMUTE
 

Ähnlich wie An Overview of the Java Programming Language (20)

Java introduction
Java introductionJava introduction
Java introduction
 
Java Tutorial
Java Tutorial Java Tutorial
Java Tutorial
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
 
CSC PPT 13.pptx
CSC PPT 13.pptxCSC PPT 13.pptx
CSC PPT 13.pptx
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
Scala: A brief tutorial
Scala: A brief tutorialScala: A brief tutorial
Scala: A brief tutorial
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript core
 
Linq Introduction
Linq IntroductionLinq Introduction
Linq Introduction
 
Intermediate JavaScript
Intermediate JavaScriptIntermediate JavaScript
Intermediate JavaScript
 
API first with Swagger and Scala by Slava Schmidt
API first with Swagger and Scala by  Slava SchmidtAPI first with Swagger and Scala by  Slava Schmidt
API first with Swagger and Scala by Slava Schmidt
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereld
 
Generics
GenericsGenerics
Generics
 
Scala
ScalaScala
Scala
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
ECMA 入门
ECMA 入门ECMA 入门
ECMA 入门
 
Computational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdfComputational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdf
 
Wrapper classes
Wrapper classes Wrapper classes
Wrapper classes
 
Java
Java Java
Java
 
CAP615-Unit1.pptx
CAP615-Unit1.pptxCAP615-Unit1.pptx
CAP615-Unit1.pptx
 

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.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 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
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
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
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
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
 
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...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

An Overview of the Java Programming Language

  • 2. Stuff about Java • Programming language • Runs on a “virtual machine” (JVM) • Platform Independent (Can run on any machine) • Object Oriented Language • Automatic Garbage Collection
  • 3. DATA TYPES • boolean: Truth value (true or false). • int: Integer (0, 1, -47). • double: Real number (3.14, 1.0, -2.1). • String: Text (“hello world”).
  • 4. Declaring and Assigning Variables Form: Type name; Examples: • String me = “Kenny”; • int x = 4; • double y;
  • 5. Operators • Assignment: = • Addition: + • Subtraction: • Multiplication: * • Division: / Form: varName Op varName; Order of Operation follow standard rules
  • 6. Methods Form: modifiers return_type name(arguments){ statements } To Call: name(arguments); Examples: public static void myMethod(int arg){ int x = 4 } public static void myMethod(int arg){ int x = 4 return x; }
  • 7. if and “else if” Statement Form: If (condition){ } Example: if(x < 4){ System.out.println(“x is less than 4”); } else if(x > 4){ System.out.println(“x is greater than 4”); } else{ System.out.println(“x must be equal to 4”); }
  • 8. COMPARISON OPERATORS • • • • • • x > y: x is greater than y x < y: x is less than y x >= y: x is greater than or equal to x x <= y: x is less than or equal to y x == y: x equals y ( equality: ==, assignment: = )
  • 9. Boolean Operators • &&: logical AND return true if true • ||: logical OR returns false if false Example: if ( x > 6 && x < 9)
  • 10. Loops Loops Information while Runs while condition is true While(x < 4){ dostuff(); } do … while Runs for the first time without checking then runs while condition is true do{ Stuff(); }while(x < 4); For Runs with optional counter while condition is true For(int I = 0; I < 4, x < 4; i++){ doStuff(); }
  • 11. Arrays • • • • An indexed list of values Any data type All elements must have the same type Form: type[] name = { val1, val2, val3 }; OR type[ ] name = new type[noOfValues]; Int [] a = { 3, 5, 6, 8, 11, 12, 15, 17, 19, 20 } Value: Index: a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9] System.out.println(a[5]); output: 12
  • 12. Classes To model real world problems // little baby 1 String name1;double weight1; // little baby2 String name2;double weight2; // little baby 3 String name3;double weight3; For 500 babies inefficient!!!
  • 13. • Using Classes  Create a class Baby  Then an array of baby or babies public class Baby { String name; boolean isMale; double weight; double decibels; } Baby[] babies = new Baby[500]; • Classes can also contain methods public class Baby { … Eat() { weight += 1; } }
  • 14. Inheritance • When a class inherits another class it has the characteristics of that class plus its own. • Classes inherit from one class • Example: A class Car can inherit from another class vehicle. • Form: modifier class className extends baseClass { }
  • 15. Interfaces • Interfaces are like classes that cannot have object instances assigned. • They can only be implemented by classes. • Classes can implement many interfaces. • Example: interface move { void accelerate(); void speed(); }

Hinweis der Redaktion

  1. This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.
  2. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  3. This is another option for an Overview slide.
  4. What will the audience be able to do after this training is complete? Briefly describe each objective how the audiencewill benefit from this presentation.
  5. Use a section header for each of the topics, so there is a clear transition to the audience.
  6. Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sampletable, graph, image, and video layouts.
  7. Keep it brief. Make your text as brief as possible to maintain a larger font size.
  8. Add a case study or class simulation to encourage discussion and apply lessons.
  9. Discuss outcomes of the case study or class simulation.Cover best practices.
  10. Summarize presentation content by restating the important points from the lessons.What do you want the audience to remember when they leave your presentation?Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)