KEMBAR78
Introduction to java Programming | PPTX
INTRODUCTION TO
PROGRAMMING WITH
JAVA
Lecture : 1
 - What is Programming ??
 Programming languages such as : C++ , C , Python ,
Java … [high . low].
 Java Technology:
Programming Language
● As a programming language, Java can create all
kinds of applications that you could create using
any conventional programming language.
Intelligent
or
Stupid
 A computer can’t understand our language It’s just understand
Something called : Binary System 0 (s) & 1 (s) .
 So we have something called Compiler {Transelator}
 What is Compiler (translator from our language to Computer’s Language ..
)
 JVM {java Virtual machine}.
 What is JDK “java Development Kit ” ?
 It’s include the Compiler , Interpreter and most tools that it’s necessary to
complier our code .
 Also it’s include the libraries and classes which we going to use like “Scanner ,
System ” .
 You can download it from .. Oracle.com
• Conversion from Decimal to binary :
For Example : 130 , 300 .
- From left to right >> with every sub process put 1 .
128
27
64
26
32
25
16
24
8
23
4
22
2
21
1
20
130 – 128 = 2
1
0 0 0 0 0 2 – 2 = 0
1
0
300 – 128 =
172 !!
 IDE’s {Editor’s}
 Note pad & any word pad
 The most Famous is “Net Beans & Eclipse”
 How to create any Project ??
1. Press file >> New Project
2. Java Application
3. Project Name
4. Main class
Note : your file will be in your workspace …
Comments ;
// just one line
Hello ,World “First Program”
 System.out,println(x); just print the value of x ..
 System.out.println(“x”) ; print litter x ..
 Sout the Tab “Short cut ”
 Println = print then make a new line .
 Print = just print .
 We can make a new Line also by n “inside quotes” .
 We can make any operation in the printing statement .
such as : 1+2 ,, 1*5 ,, an so on .
- (your name) every part in separate line by using println and n .
- print something like that“1 + 5 =” 6 .
Your turn
Any Questions ?
Printf :
 It’s a method for printing but it’s easier
 For Example
Note the Difference :
 %s >> it means you are going to Enter String Value .
 %d >> means that you are going to Enter Decimal number .
 %n = n >> to Make a new line ..
NOW LET’s Try ..
Welcome to
Java Programming!
5+5 = 10
Your turn
System.out.printf("%s %n %s %n %s %d" , "Welcome to","java Programming! " , "5+5" ,10);
//Error ;)
 For right Number
 Byte
 Short
 Int
 Long
 Decimal Number :
 Float
 Double
 Character >> char
 Boolean {true or false }
String …
Example .. Sum
Variables & identifiers .. : )
Input / Scanner
SCANNER INPUT = NEW SCANNER(SYSTEM.IN);
Comparison Operations
 When you make any comparison you will need some of these Operands :
 x == y , x >= y , x <= y , x > y , x < y .
Logic Operations : { && , || , ! }
 Examples on if Condition and logic Operations
,,
Calculator again { + , - , * , % , / }
Fail & pass { if <50 : Fail ,, }
Comparison between two numbers x , y ;
Even or Odd
Absolute
number divisible by 5 or no ..
Comparison between three Numbers
Your turn
Try it ..
Let's Play!
Imagine that you want to print your
name 50 times ..
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
System.out.println(“Ahmed Ayman ”);
…………………………….
Loops !
FOR, NESTED LOOPS
FOR STRUCTURE
FOR(INT COUNTER = 1 ; COUNTER <= 50;COUNTER++) //+1
{
//CODE SUCH AS PRINT (“AHMED AYMAN”);
}
For Structure
 for(INITIALIZATION ; CONDITION ; ITERATING STEP)
 {
 //Loop body
 }
 Examples
 Print your Name 10 Times .. Try it
 From 1 to 100 with printf .. And reverse it .
 Numbers which can divide by 5 .
 Multiplication table
 Nested Loops ,,
For ( ; ; ){
For ( ; ; ){
}
}
Multiplication Table ..
int x = 0 ;
for (int i = 1 ; i <= 12 ; i++)
{
for (int j = 1 ; j <= 12 ; j++)
{
x = i * j ;
System.out.println(i+"*"+j+"="+x );
}
System.out.println("n");
}
}
End of the text :D
Introduction to java Programming
Introduction to java Programming
Introduction to java Programming

Introduction to java Programming

  • 1.
  • 4.
     - Whatis Programming ??  Programming languages such as : C++ , C , Python , Java … [high . low].  Java Technology: Programming Language ● As a programming language, Java can create all kinds of applications that you could create using any conventional programming language.
  • 5.
  • 6.
     A computercan’t understand our language It’s just understand Something called : Binary System 0 (s) & 1 (s) .  So we have something called Compiler {Transelator}  What is Compiler (translator from our language to Computer’s Language .. )  JVM {java Virtual machine}.  What is JDK “java Development Kit ” ?  It’s include the Compiler , Interpreter and most tools that it’s necessary to complier our code .  Also it’s include the libraries and classes which we going to use like “Scanner , System ” .  You can download it from .. Oracle.com
  • 7.
    • Conversion fromDecimal to binary : For Example : 130 , 300 . - From left to right >> with every sub process put 1 . 128 27 64 26 32 25 16 24 8 23 4 22 2 21 1 20 130 – 128 = 2 1 0 0 0 0 0 2 – 2 = 0 1 0 300 – 128 = 172 !!
  • 9.
     IDE’s {Editor’s} Note pad & any word pad  The most Famous is “Net Beans & Eclipse”
  • 12.
     How tocreate any Project ?? 1. Press file >> New Project 2. Java Application 3. Project Name 4. Main class Note : your file will be in your workspace …
  • 13.
  • 14.
    Hello ,World “FirstProgram”  System.out,println(x); just print the value of x ..  System.out.println(“x”) ; print litter x ..  Sout the Tab “Short cut ”
  • 15.
     Println =print then make a new line .  Print = just print .  We can make a new Line also by n “inside quotes” .  We can make any operation in the printing statement . such as : 1+2 ,, 1*5 ,, an so on . - (your name) every part in separate line by using println and n . - print something like that“1 + 5 =” 6 . Your turn
  • 16.
  • 17.
    Printf :  It’sa method for printing but it’s easier  For Example Note the Difference :
  • 18.
     %s >>it means you are going to Enter String Value .  %d >> means that you are going to Enter Decimal number .  %n = n >> to Make a new line .. NOW LET’s Try .. Welcome to Java Programming! 5+5 = 10 Your turn
  • 19.
    System.out.printf("%s %n %s%n %s %d" , "Welcome to","java Programming! " , "5+5" ,10); //Error ;)
  • 20.
     For rightNumber  Byte  Short  Int  Long  Decimal Number :  Float  Double  Character >> char  Boolean {true or false } String … Example .. Sum Variables & identifiers .. : )
  • 22.
    Input / Scanner SCANNERINPUT = NEW SCANNER(SYSTEM.IN);
  • 24.
    Comparison Operations  Whenyou make any comparison you will need some of these Operands :  x == y , x >= y , x <= y , x > y , x < y . Logic Operations : { && , || , ! }
  • 25.
     Examples onif Condition and logic Operations ,, Calculator again { + , - , * , % , / } Fail & pass { if <50 : Fail ,, } Comparison between two numbers x , y ; Even or Odd Absolute number divisible by 5 or no .. Comparison between three Numbers Your turn
  • 26.
  • 27.
  • 29.
    Imagine that youwant to print your name 50 times .. System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); System.out.println(“Ahmed Ayman ”); …………………………….
  • 31.
    Loops ! FOR, NESTEDLOOPS FOR STRUCTURE FOR(INT COUNTER = 1 ; COUNTER <= 50;COUNTER++) //+1 { //CODE SUCH AS PRINT (“AHMED AYMAN”); }
  • 32.
    For Structure  for(INITIALIZATION; CONDITION ; ITERATING STEP)  {  //Loop body  }  Examples  Print your Name 10 Times .. Try it  From 1 to 100 with printf .. And reverse it .  Numbers which can divide by 5 .  Multiplication table
  • 33.
     Nested Loops,, For ( ; ; ){ For ( ; ; ){ } }
  • 34.
    Multiplication Table .. intx = 0 ; for (int i = 1 ; i <= 12 ; i++) { for (int j = 1 ; j <= 12 ; j++) { x = i * j ; System.out.println(i+"*"+j+"="+x ); } System.out.println("n"); } }
  • 35.
    End of thetext :D

Editor's Notes

  • #28 المربع الازرق دا بيت واحد صاحبك و انت متفق معاه تقابله بعربييتك و تروحوا الكلية سوا و انت جاى مع اتجاه السهم .. بس لما وصلت عند البيت اتصلت بيه و لقيته لسا بيلبس و منزلش و المشكلة الأكبر إن الطريق حارة واحدة ومش هينفع تركن تستناه علشان متوقفش الشارع .. هتعمل ايه ؟!