SlideShare a Scribd company logo
1 of 16
Java programming
Hoshmand kareem salih
1
An introduction to
Prepared by
contents
Java programming By Hoshmand Kareem 2
Writing first program
using variables
Data types
Using printf
Operators
If-else
Loops
Methods
Switch
Arrays
Writing first program
Public class name {
Public static void main(String args [] ) {
System.out.println(“Welcome to java”);
}
}
Java programming By Hoshmand Kareem 3
using variables
variables are used with names , they represent
data and objects like :
Int a=12;
Scanner input=new Scanner(System.in);
Input and a are variables
Java programming By Hoshmand Kareem 4
Data types
• Data just like the name are memories that holds information as
Strings, integers and floating numbers and declared with a variable
• There are different types of data
Data type declare in java
1) Integer numbers byte, short, int, and long
2) Floating point numbers float and double
3) Strings String
4) Characters char
5) Boolean boolean
Java programming By Hoshmand Kareem 5
Using printf
• The expression of Printf is used for putting data
into a String
• Type into the String %(d , f and s) where you want
to add the data , then when the String finishes
after (”) type (,name of the data)
Int x=14; String v=“java” ; float b=77.99; double n=88.9;
System.out.printf(“%d %s %f %f”,x,v,b,n);
Java programming By Hoshmand Kareem 6
Operators
• Precedence and associativity of operators
• Operators Associativity Type
• * / % left to right multiplicative
• + - left to right additive
• < <= > >= left to right relational
• == != left to right equality
• = right to left assignment
Java programming By Hoshmand Kareem 7
If-else
• conditional statements are used in java like if-else
statement
Ex) if (x>y) {
System.out.println(“x is greater than y”);
}
When the value of x goes bigger than y it prints x is
greater than y
Java programming By Hoshmand Kareem 8
Loops
• Loops are a control statements that perform
specific instructions more than one time as
long as the condition is available(true)
• Loops are so kinds like
For , while , do-while
Java programming By Hoshmand Kareem 9
Methods
• Methods are parts of the program that
includes instructions
• There are different kinds of methods that
some of them just perform instructions and
some are returning a specific data , data are
sends through parameters into a method
Java programming By Hoshmand Kareem 10
Methods
• Methods has security levels , types , names ,
parameters
• Security levels public , protected ,private
• Type void , int , double , String …
• Parameters (int x , String s ,double d)
Java programming By Hoshmand Kareem 11
Methods
• Declaring a method
Public void name (String s){
System.out.println(s);
}
Public int name (int n){
Return n*n+Math.pow(n,10);
}
Java programming By Hoshmand Kareem 12
Methods
• Declaring an object of a class , so it can run
the methods of the class its made of and send
the data through the parameter
classname name=new classname ();
name.methodname(12,”hello”,77.08);
Java programming By Hoshmand Kareem 13
switch
• Switch is used for performing different instructions in
different cases that stands on one variable or situation
Switch(x){
Case 1:
System.out.println(“one”);
Case 2:
System.out.println(“two”);
}
Java programming By Hoshmand Kareem 14
Arrays
• Array is a variable , that could be spitted into a
huge mount of indexes that each index can
hold another data
Int a []=new int [number of indexes];
a[0]=2; a[1]=3 a[2]=6;
Java programming By Hoshmand Kareem 15
THE END
That is all…
Thanks for watching…
Java programming By Hoshmand Kareem
16

More Related Content

What's hot (19)

1. Overview of Java
1. Overview of Java1. Overview of Java
1. Overview of Java
 
8. String
8. String8. String
8. String
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception Handling
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
 
2. Basics of Java
2. Basics of Java2. Basics of Java
2. Basics of Java
 
Net framework
Net frameworkNet framework
Net framework
 
Cis166 Final Review C#
Cis166 Final Review C#Cis166 Final Review C#
Cis166 Final Review C#
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Keyword of java
Keyword of javaKeyword of java
Keyword of java
 
Java2
Java2Java2
Java2
 
13. Queue
13. Queue13. Queue
13. Queue
 
02 data types in java
02 data types in java02 data types in java
02 data types in java
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
Method overloading and constructor overloading in java
Method overloading and constructor overloading in javaMethod overloading and constructor overloading in java
Method overloading and constructor overloading in java
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
5. c sharp language overview part ii
5. c sharp language overview   part ii5. c sharp language overview   part ii
5. c sharp language overview part ii
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
 
Keywords and classes
Keywords and classesKeywords and classes
Keywords and classes
 

Similar to An introduction to java programming

Similar to An introduction to java programming (20)

Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
Computational Problem Solving 016 (1).pptx
Computational Problem Solving 016 (1).pptxComputational Problem Solving 016 (1).pptx
Computational Problem Solving 016 (1).pptx
 
Programming in java basics
Programming in java  basicsProgramming in java  basics
Programming in java basics
 
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
 
CSC111-Chap_02.pdf
CSC111-Chap_02.pdfCSC111-Chap_02.pdf
CSC111-Chap_02.pdf
 
9781439035665 ppt ch03
9781439035665 ppt ch039781439035665 ppt ch03
9781439035665 ppt ch03
 
Full CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java languageFull CSE 310 Unit 1 PPT.pptx for java language
Full CSE 310 Unit 1 PPT.pptx for java language
 
Generics
GenericsGenerics
Generics
 
Linq Introduction
Linq IntroductionLinq Introduction
Linq Introduction
 
Variables and Data Types
Variables and Data TypesVariables and Data Types
Variables and Data Types
 
Java Notes
Java Notes Java Notes
Java Notes
 
Java Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPRECJava Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPREC
 
Getting Program Input
Getting Program Input Getting Program Input
Getting Program Input
 
Java introduction
Java introductionJava introduction
Java introduction
 
Learn ActionScript programming myassignmenthelp.net
Learn ActionScript programming myassignmenthelp.netLearn ActionScript programming myassignmenthelp.net
Learn ActionScript programming myassignmenthelp.net
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
 
UNIT1-JAVA.pptx
UNIT1-JAVA.pptxUNIT1-JAVA.pptx
UNIT1-JAVA.pptx
 
Java method present by showrov ahamed
Java method present by showrov ahamedJava method present by showrov ahamed
Java method present by showrov ahamed
 
Java
JavaJava
Java
 
Lec4
Lec4Lec4
Lec4
 

Recently uploaded

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 

Recently uploaded (20)

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 

An introduction to java programming

  • 1. Java programming Hoshmand kareem salih 1 An introduction to Prepared by
  • 2. contents Java programming By Hoshmand Kareem 2 Writing first program using variables Data types Using printf Operators If-else Loops Methods Switch Arrays
  • 3. Writing first program Public class name { Public static void main(String args [] ) { System.out.println(“Welcome to java”); } } Java programming By Hoshmand Kareem 3
  • 4. using variables variables are used with names , they represent data and objects like : Int a=12; Scanner input=new Scanner(System.in); Input and a are variables Java programming By Hoshmand Kareem 4
  • 5. Data types • Data just like the name are memories that holds information as Strings, integers and floating numbers and declared with a variable • There are different types of data Data type declare in java 1) Integer numbers byte, short, int, and long 2) Floating point numbers float and double 3) Strings String 4) Characters char 5) Boolean boolean Java programming By Hoshmand Kareem 5
  • 6. Using printf • The expression of Printf is used for putting data into a String • Type into the String %(d , f and s) where you want to add the data , then when the String finishes after (”) type (,name of the data) Int x=14; String v=“java” ; float b=77.99; double n=88.9; System.out.printf(“%d %s %f %f”,x,v,b,n); Java programming By Hoshmand Kareem 6
  • 7. Operators • Precedence and associativity of operators • Operators Associativity Type • * / % left to right multiplicative • + - left to right additive • < <= > >= left to right relational • == != left to right equality • = right to left assignment Java programming By Hoshmand Kareem 7
  • 8. If-else • conditional statements are used in java like if-else statement Ex) if (x>y) { System.out.println(“x is greater than y”); } When the value of x goes bigger than y it prints x is greater than y Java programming By Hoshmand Kareem 8
  • 9. Loops • Loops are a control statements that perform specific instructions more than one time as long as the condition is available(true) • Loops are so kinds like For , while , do-while Java programming By Hoshmand Kareem 9
  • 10. Methods • Methods are parts of the program that includes instructions • There are different kinds of methods that some of them just perform instructions and some are returning a specific data , data are sends through parameters into a method Java programming By Hoshmand Kareem 10
  • 11. Methods • Methods has security levels , types , names , parameters • Security levels public , protected ,private • Type void , int , double , String … • Parameters (int x , String s ,double d) Java programming By Hoshmand Kareem 11
  • 12. Methods • Declaring a method Public void name (String s){ System.out.println(s); } Public int name (int n){ Return n*n+Math.pow(n,10); } Java programming By Hoshmand Kareem 12
  • 13. Methods • Declaring an object of a class , so it can run the methods of the class its made of and send the data through the parameter classname name=new classname (); name.methodname(12,”hello”,77.08); Java programming By Hoshmand Kareem 13
  • 14. switch • Switch is used for performing different instructions in different cases that stands on one variable or situation Switch(x){ Case 1: System.out.println(“one”); Case 2: System.out.println(“two”); } Java programming By Hoshmand Kareem 14
  • 15. Arrays • Array is a variable , that could be spitted into a huge mount of indexes that each index can hold another data Int a []=new int [number of indexes]; a[0]=2; a[1]=3 a[2]=6; Java programming By Hoshmand Kareem 15
  • 16. THE END That is all… Thanks for watching… Java programming By Hoshmand Kareem 16