??????????????? JAVA ??????????? - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

??????????????? JAVA ???????????

Description:

java . – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 29
Provided by: Medt158
Category:
Tags: java | operators

less

Transcript and Presenter's Notes

Title: ??????????????? JAVA ???????????


1
??????????????? JAVA ???????????
  • ??? ?. ??????? ????????
  • http//www.siam2dev.com
  • xnattapong_at_hotmail.com

2
????????????(Operator)
  • ?????????????????????????(Arithmetic Operators)
  • ???????????????????????(Relational Operators)
  • ????????????????????(Bitwise Operators)
  • ?????????????????????????(Logical Operators)

3
?????????????????????????(Arithmetic Operators)
  • ??????????? ???????? ????????
  • ??? ab
  • - ?? a-b
  • ??? ab
  • / ??? a/b
  • ???????????? ab (Modulus)

4
Example Of Arithmetic Operators
  • public class testing //????????testing.java
  • public static void main()
  • int a5,b2,c6
  • aab
  • ba-c
  • bb2
  • aa/2
  • cab
  • System.out.println("a"a",b"b",c"c)

5
???????????????????????(Relational Operators)
  • ??????????? ???????? ????????
  • gt ??????? agtb
  • gt ?????????????????? agtb
  • lt ???????? altb
  • lt ??????????????????? altb
  • ??????? a b
  • ! ?????????? a!b

6
Example Of Relational Operators
  • public class testing
  • public static void main(String args)
  • int value110,value220,value310
  • System.out.println(value1gtvalue2)
  • System.out.println(value1gtvalue3)
  • System.out.println(value1ltvalue2)
  • System.out.println(value1ltvalue3)
  • System.out.println(value1value2)
  • System.out.println(value1!value2)

7
????????????????????(Bitwise Operators)
  • ??????????? ???????? ????????
  • gtgt Shift ??????????? agtgtb
  • ltlt Shift ???????????? altltb
  • and ab
  • or ab
  • xor ab
  • complement a

8
Example Of Bitwise Operators
  • public class test // ????????test.java
  • public static void main(String args)
  • System.out.println(7gtgt2(7gtgt2))
  • System.out.println(7ltlt2(7ltlt2))
  • System.out.println(51 (51))
  • System.out.println(52 (52))
  • System.out.println(16 (16))
  • System.out.println(7 (7))

9
?????????????????????????(Logical Operators)
  • ??????????? ????????
  • a b (conditional)
  • a b (conditional)
  • ! !a

10
if else ???????????
  • if(condition1)
  • statement1
  • else if(condition2)
  • statement2
  • statement3
  • else
  • statement4

11
Example Of if else
  • Condition ?????????????????????
  • If gt ???
  • else gt ???????????if

12
Example Of if else (2)
  • public class testing
  • public static void main(String args)
  • boolean atrue
  • char A'T',B'F'
  • if(a)
  • System.out.println(A)
  • else
  • System.out.println(B)

13
Example Of if else (3)
  • public class testing
  • public static void main(String args)
  • int aInteger.parseInt(args0)
  • if(agt50)
  • System.out.println("The Value is higher
    than fifty.")
  • else if(a50)
  • System.out.println("The Value is equal
    fifty.")
  • else
  • System.out.println("The Value is lower than
    fifty.")

14
Example Of if else (3)
  • public class testing
  • public static void main(String args)
  • int aInteger.parseInt(args0)
  • int bInteger.parseInt(args1)
  • if(agt50bgt50)
  • System.out.println("The Value A And B are
    higher than fifty.")
  • else if(a50b50)
  • System.out.println("The Value A And B are
    equal fifty.")
  • else if(alt50blt50)
  • System.out.println("The Value A And B are
    lower than fifty.")
  • else if(agt50bgt50)
  • System.out.println("The Value A Or B is
    higher than fifty.")
  • else if(a50b50)
  • System.out.println("The Value A Or B are
    equal fifty.")
  • else if(alt50blt50)
  • System.out.println("The Value A Or B are
    lower than fifty.")

15
Example Of if else (4)
  • public class testing
  • public static void main(String args)
  • int aInteger.parseInt(args0)
  • int bInteger.parseInt(args1)
  • if(agt50bgt50)
  • System.out.println("The Value A And B are
    higher than fifty.")
  • if(a50b50)
  • System.out.println("The Value A And B are
    equal fifty.")
  • if(alt50blt50)
  • System.out.println("The Value A And B are
    lower than fifty.")
  • if(agt50bgt50)
  • System.out.println("The Value A Or B is
    higher than fifty.")
  • if(a50b50)
  • System.out.println("The Value A Or B are
    equal fifty.")
  • if(alt50blt50)
  • System.out.println("The Value A Or B are
    lower than fifty.")

16
Switch - case
  • switch(variable)
  • case value1 statement
  • statement
  • statement
  • break
  • case value2 statement
  • statement
  • statement
  • break
  • default

17
Example Of Switch - case
  • public class testing
  • public static void main(String args)
  • int aInteger.parseInt(args0)
  • switch(a)
  • case (50)System.out.println("The Value is
    equal fifty.")
  • case (40)System.out.println("The Value is
    equal forty.")
  • case (30)System.out.println("The Value is
    equal thirty.")
  • default System.out.println(Not
    equal Anything.")

18
Array
  • Array ???????
  • ????????????? Array
  • ?????????? ??????????
  • ?????????? ??????????
  • ???????????? Array
  • ?????????????????????????array new
    ???????????????n

19
Example Of Array
  • public class testing
  • public static void main(String args)
  • int a
  • int b
  • a new int3
  • b new int2
  • int c new int2
  • a01
  • a12
  • a23
  • b04
  • b15
  • c06
  • c17
  • System.out.print(a0""a1""a2)
  • System.out.print(b0""b1""c0""c1
    )

20
Example Of Array (2)
  • public class testing
  • public static void main(String args)
  • int a,b,c
  • a new int3
  • b new int2
  • c new int2
  • a01
  • a12
  • a23
  • b04
  • b15
  • c06
  • c17
  • System.out.print(a0""a1""a2)
  • System.out.print(b0""b1""c0""c1
    )

21
Example Of Array (3)
  • public class testing
  • public static void main(String args)
  • String arr Testing , Test ,
    end of array
  • int a 1,2,3
  • int b 4,5
  • int c 6,7
  • System.out.print(a0""a1""a2)
  • System.out.print(b0""b1""c0""c1
    )
  • System.out.print(arr0arr1arr2)

22
Example Of Array (4)
  • public class testing
  • public static void main(String args)
  • String art "Testing", "Test", "end of
    array"
  • int a 1,2,3
  • int b 4,5
  • int c 6,7
  • System.out.print(a0""a1""a2)
  • System.out.print(b0""b1""c0""c1
    "\n")
  • System.out.print(art0" "art1" "art2)

23
Array 2 Dimension
  • ?????????? ??????????m
  • ??????????0 ??????????n
  • m ????????
  • n ????????????

24
Example Of Array 2 Dimension
  • public class testing
  • public static void main(String args)
  • int a new int3
  • a0 new int1
  • a1 new int2
  • a2 new int3

25
Example Of Array 2 Dimension(2)



26
Assignment
  • ???????????????????????????????????
    ???????????????????????????????
    ??????????????????????????
  • A gt80
  • B gt75lt80
  • B gt70lt75
  • C gt65lt70
  • C gt60lt65
  • D gt55lt60
  • D gt50lt55
  • F lt50
  • ????
  • Java testing 90
  • Your Grade is A!!!.

27
Assignment (2)
  • ???????????????????????Array????? 5 ????
    ??????????????????????? 4 ??????????????User
    ??????????????????????????????????????????????????
    ??????
  • Java assignment2 10 20 30 40
  • Your summary is 100

28
Assignment (3)
  • ???????????????????? ??????array 2 ????
  • ???????
  • 1
  • 2 3
  • 5 8 13
  • 21 34 55 89
  • 144 233 377 610 987
Write a Comment
User Comments (0)
About PowerShow.com