หัวข้อ
Markdown | HTML | Github/Markdown | Github.io | คำสำคัญ (Key)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
# การเขียนโปรแกรมจาวา
## JAVA Programming
### Thaiall.com/class 3(2-2-5)
### ปรับปรุง 6 สิงหาคม 2563
 
[Burin rujjanapan](http://www.facebook.com/ajburin)
 
---
 
# โฮมเพจที่เกี่ยวข้อง
 
- [โฮมเพจหลักประจำวิชา](http://www.thaiall.com/class)
- http://www.thaiall.com/class/javaintro.docx
 
---
 
# เอกสาร Powerpoint
 
1.  http://www.thaiall.com/class/java_intro.ppt
2.  http://www.thaiall.com/class/java_uml1.ppt
3.  http://www.thaiall.com/class/java_keyword.ppt
4.  http://www.thaiall.com/class/java_error.ppt
5.  http://www.thaiall.com/class/java_structure.ppt
6.  http://www.thaiall.com/class/java_pyramid.ppt
7.  http://www.thaiall.com/class/java_input_output.ppt
8.  http://www.thaiall.com/class/java_string.ppt
9.  http://www.thaiall.com/class/java_method1.ppt
10. http://www.thaiall.com/class/java_array.ppt
11. http://www.thaiall.com/class/java_oo.ppt
12. http://www.thaiall.com/class/java_exception.ppt
13. http://www.thaiall.com/class/java_textfile.ppt
14. http://www.thaiall.com/class/java_applet1.ppt
15. http://www.thaiall.com/class/pro_pmy.htm
16. http://www.thaiall.com/class/java_jar.ppt
17. http://www.thaiall.com/class/pretest49.ppt
18. http://www.thaiall.com/class/java_2_520409.doc
 
---
 
# เอกสาร Manual ภาษา PHP
 
- **เอกสารสำหรับผู้เริ่มต้น เป็นคู่มือแบบที่พบใน php.net**
- แฟ้มขนาด 12 MB เปิดด้วย Browser เอกสาร HTML + Image
- http://th.php.net/get/php_manual_en.tar.gz/from/a/mirror
- **เอกสารสำหรับมืออาชีพ**
- แฟ้มขนาด 3.5 MB เป็น PDF
- รวบรวมจาก Stack Overflow เพื่อการศึกษา
- phpnotesforprofessionals.pdf
- http://books.goalkicker.com/PHPBook
- https://goalkicker.com/HTML5Book/
- https://goalkicker.com/JavaScriptBook/
- https://goalkicker.com/jQueryBook/
- https://goalkicker.com/MySQLBook/
 
---
 
# หน่วยที่ 1 หลักการเขียนโปรแกรม
 
- ความเป็นมาของภาษา [1]
- ตัวแปลภาษา [2]
- Argument [3]
- การใช้อีดิเตอร์ [4]
 
---
 
# ความเป็นมาของภาษา [1]
 
- บริษัท Sun Microsystems, Inc. ถูกซื้อโดยบริษัท Oracle ประมาณ 7.4 พันล้านดอลลาร์ 20 เมษายน 2552 หลังตกลงกันไม่ได้กับบริษัท IBM ปัจจุบันเรายังสามารถดาวน์โหลด Java Platform, Standard Edition มาใช้ได้ โดยแบ่งเป็น JDK (Java Development Kit for Developer) และ JRE (Java Runtime Environment)
- จาวา คือ ภาษาการโปรแกรม ถูกพัฒนาโดยบริษัทซันไมโครซิสเท็ม และเปิดตัวในปีพ.ศ. 2538 และขายให้บริษัท Oracle ในพ.ศ.2552 โปรแกรมที่นำไปใช้ได้จะถูกแปลให้อยู่ในรูปของไบท์โค้ด เมื่อนำไปประมวลผลจะมีตัวแปลภาษาที่ทำให้ไบท์โค้ดสามารถทำงานได้ในแต่ละอุปกรณ์ ซึ่งถูกนำไปใช้อย่างแพร่หลายสำหรับการพัฒนาเว็บ รูปแบบมีรากฐานจากภาษา C และ C++ แล้วยังเป็นภาษาที่ง่ายต่อการออกแบบโปรแกรมเชิงวัตถุ และเป็นภาษาหลักสำหรับพัฒนาแอพพลิเคชั่นบน Android OS ที่นิยมใช้บน TabletPC หรือ SmartPhone
- [javaintro.docx](http://www.thaiall.com/class/javaintro.docx)
 
---
 
# ตัวแปลภาษา [2]
 
- Java SE Development Kit 14
- Java Runtime Environment
- https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
 
---
 
# Argument [3]
 
```
// ::: โปรแกรมลำดับที่ 1
// 1. ประมวลผล เช่น javac j0100.java
// 2. ประมวลผล เช่น java j0100 abc def
// 3. สามารถรับ parameter มาประมวลผลในโปรแกรมได้
// 4. ผลที่ได้จะเห็นเลข 2 เพราะรับข้อมูลเข้าไป 2 ค่า
class J0100 {
public static void main(String args[]) {
  System.out.println(args.length);
  System.out.println(args[0]);   // abc
}
}
```
 
---
 
# การใช้อีดิเตอร์ [4]
 
- การใช้ vscode compile และ run
- http://www.thaiall.com/vscode/
 
---
 
# หน่วยที่ 2 ตัวแปร และชนิดของข้อมูล
 
- สัญลักษณ์และคำสงวน [1]
- ชนิดของข้อมูล [2]
- ตัวดำเนินการ [3]
- การแปลงชนิดของข้อมูล [4]
 
---
 
# สัญลักษณ์และคำสงวน [1]
 
 **1. Access Modifiers**
  
- private : Makes a method or a variable accessible only from within its own class.
- protected : Makes a method or a variable accessible only to classes in the same package or subclasses of the class.
- public : Makes a class, method, or variable accessible from any other class.
 
---
 
# สัญลักษณ์และคำสงวน
 
 **2. Class, Method, and Variable Modifiers **
  
- abstract : Used to declare a class that cannot be instantiated, or a method that must be implemented by a nonabstract subclass.
- class : Keyword used to specify a class.
- extends : Used to indicate the superclass that a subclass is extending.
- final : Makes it impossible to extend a class, override a method, or reinitialize a variable.
- implements : Used to indicate the interfaces that a class will implement.
- interface : Keyword used to specify an interface.
- native : Indicates a method is written in a platform-dependent language, such as C.
- new : Used to instantiate an object by invoking the constructor.
- static : Makes a method or a variable belong to a class as opposed to an instance.
- strictfp : Used in front of a method or class to indicate that floating-point numbers will follow FP-strict rules in all expressions.
- synchronized : Indicates that a method can be accessed by only one thread at a time.
- transient : Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized.
- volatile : Indicates a variable may change out of sync because it is used in threads.
 
---
 
# สัญลักษณ์และคำสงวน
 
 **3. Flow Control **
  
- break : Exits from the block of code in which it resides.
- case : Executes a block of code, dependent on what the switch tests for.
- continue : Stops the rest of the code following this statement from executing in a loop and then begins the next iteration of the loop.
- default : Executes this block of code if none of the switch-case statements match.
- do : Executes a block of code one time, then, in conjunction with the while statement, it performs a test to determine whether the block should be executed again.
- else : Executes an alternate block of code if an if test is false.
- for : Used to perform a conditional loop for a block of code.
- if : Used to perform a logical test for true or false.
- instanceof : Determines whether an object is an instance of a class, superclass, or interface.
- return : Returns from a method without executing any code that follows the statement (can optionally return a variable).
- switch : Indicates the variable to be compared with the case statements.
- while : Executes a block of code repeatedly while a certain condition is true.
 
---
 
# สัญลักษณ์และคำสงวน
 
 **4. Error Handling  **
  
- catch : Declares the block of code used to handle an exception.
- finally : Block of code, usually following a try-catch statement, which is executed no matter what program flow occurs when dealing with an exception.
- throw : Used to pass an exception up to the method that called this method.
- throws : Indicates the method will pass an exception to the method that called it.
- try : Block of code that will be tried, but which may cause an exception.
- assert : Evaluates a conditional expression to verify the programmer’s assumption.
 
 **5. Package Control **
  
- import : Statement to import packages or classes into code.
- package : Specifies to which package all classes in a source file belong.
 
---
 
# สัญลักษณ์และคำสงวน
 
 **6. Primitives **
 
- boolean : A value indicating true or false.
- byte : An 8-bit integer (signed).
- char : A single Unicode character (16-bit unsigned)
- double : A 64-bit floating-point number (signed).
- float : A 32-bit floating-point number (signed).
- int : A 32-bit integer (signed).
- long : A 64-bit integer (signed).
- short : A 16-bit integer (signed).
 
---
 
# สัญลักษณ์และคำสงวน
 
 **7. Variable Keywords **
 
- super : Reference variable referring to the immediate superclass.
- this : Reference variable referring to the current instance of an object.
 
 **8. Void Return Type Keyword  **
 
- void : Indicates no return type for a method.
 
 **9. Unused Reserved Words **
 
- const : Do not use to declare a constant; use public static final.
- goto : Not implemented in the Java language. It’s considered harmful.
 
---
 
# ชนิดของข้อมูล [2]
 
```
// :::: โปรแกรมลำดับที่ 2
// 6 Primitive Data Type
class J0101 {
public static void main(String args[]) {
// 1. boolean true of false
boolean b = true;
System.out.println("boolean = "+b);
// 2. character (2 Byte)
char y;
y = 'a';
System.out.println("character = "+y);
// 3. byte -2^7 to 2^7-1 (1 Byte)
byte c;
c = 127;
System.out.println("byte = "+c);
// 4. short -2^15 to 2^15-1 (2 Byte)
short a;
a = 32767;
System.out.println("Short = "+a);
// 5. integer -2^31 to 2^31-1 (4 Byte)
int x;
x = 2147483647;
System.out.println("Integer = "+x);
// 6. long -2^63 to 2^63-1 (8 Byte)
long b;
b = 9223372036854775807L;
System.out.println("long = "+b);
}
}
```
 
---
 
# pro
 
```
// :::: โปรแกรมลำดับที่ 3
// 1. 2 Primitive Data Type
// 2. แสดงผลจากค่าที่กำหนดขึ้น และการใช้ function
// 3. ประกาศ และใช้อาร์เรย์
class J0102 {
public static void main(String args[]) {
// 7. float -3.4e38 to 3.4e38 (4 Byte)
float d;
d = 340000000000000000000000000000000000000f;
System.out.println("float = "+d);
// 8. double -1.7e308 to 1.7e308 (8 Byte)
double e;
e = 17900000000000000000000000000000000000000d;
System.out.println("double = "+e);
// String aa = Double.toString(Double.parseDouble("123") + 1);
// String aa = Integer.toString(Integer.parseInt("456") + 2);
// aa = aa.substring(0,3);
// String : Abstact data type
// หรือ String z = new String("ThaiAll");
String z ="ThaiAll";
System.out.println("string = "+z);
System.out.println(z.substring(0,4));  // Thai
System.out.println(z.substring(2,5));  // aiA
System.out.println(z.substring(4));    // All
System.out.println(z.toUpperCase());   // THAIALL
System.out.println(z.toLowerCase());   // thaiall
char ar[] = new char[128];
ar = z.toCharArray();
System.out.println((char)ar[0]);       // T
System.out.println(ar[0]);             // T
System.out.println(ar[2] + ar[4]);     // 162 (97 + 65)
z = "1234.1";
int m = Integer.parseInt(z.substring(0,3)) + 5;  // 123 + 5
double n = Double.parseDouble(z) + 0.2;          // 1234.3
System.out.println(m + n);           // 128 + 1234.3 = 1362.3
System.out.println(Integer.toString(m) + 5);      // 1285
}
}
```
 
---
 
# ตัวดำเนินการ [3]
 
** Operator**
 
```
Classification  Operators
Arithmetic  + - * / %
Relational Operators    < > >= <= == != && || !
Bitwise Operators   & | ^ << >> >>> - &= |= ^=
Assignments = += -= /= %=
Bitwise Assignments &= |= <<= >>= >>>= ^=
Ternary Operator
(if...else shorthand)   ?:
Increment   ++
Decrement   --
```
 
---
 
# การแปลงชนิดของข้อมูล [4]
 
```
int x;
x = 8/3;
System.out.println(x); // 2
float a = 5/(float)3; // 1.6666666
float b = (float)5/3; // 1.6666666
double c = 5/(double)3; // 1.6666666666666667
float d = (float)(5/3); // 1.0
float e = 5/3; // 1.0
```
 
---
 
# หน่วยที่ 3 การโปรแกรมโครงสร้าง
 
- การทำงานแบบตามลำดับ [1]
- การเลือกกระทำตามเงื่อนไข [2]
- การทำซ้ำ [3]
 
---
 
# การทำงานแบบตามลำดับ [1]
 
```
// ::: โปรแกรมลำดับที่ 10
// 1. แสดงการรับค่าจากแป้นพิมพ์แบบ character
// 2. รับข้อมูลได้เพียง 1 ตัวอักษร และแสดงผล
import java.io.*;
class J0301 {
public static void main(String args[]) throws IOException {
char buf;
buf = (char)System.in.read();
System.out.println("Output is "+buf);
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 11
// 1. แสดงการรับค่าจากแป้นพิมพ์แบบ character
// 2. รับ 2 ตัวอักษรมาแสดงผลต่อกัน
import java.io.*;
class J0302 {
public static void main(String args[]) throws IOException {
char buf1,buf2;
buf1 = (char)System.in.read();
buf2 = (char)System.in.read();
System.out.println("Output is "+buf1+buf2);
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 13
// 1. รับตัวเลข 2 จำนวนแล้วนำมาบวกกัน เพื่อแสดงผล
// 2. ใช้ BufferedReader ในการรับข้อมูล
import java.io.*;
class J0304 {
public static void main(String args[]) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String buf;
int i1,i2,i3;
buf = stdin.readLine();
i1 = Integer.parseInt(buf);
buf = stdin.readLine();
i2 = Integer.parseInt(buf);
i3 = i1 + i2;
System.out.println("Output is "+i1+" + "+i2+" = "+i3);
}
}
```
 
---
 
# การเลือกกระทำตามเงื่อนไข [2]
 
```
// :::: โปรแกรมลำดับที่ 4
// 1. แสดงการใช้คำสั่ง if
// 2. ความแตกต่างของ print และ println
// 3. การใช้ { } หรือไม่ใช้ ต่างกันอย่างไร
class J0201 {
public static void main(String args[]) {
int x;
x = 6;
if (x > 5) System.out.println("more than 5:" + x);
if (x > 5 && x < 10) System.out.println("five to ten");
if (x > 5 || x < 10) System.out.println("all numbers");
if (x > 10) {
System.out.print("more than 10:");
System.out.println(x);
}
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 5
// 1. แสดงการใช้คำสั่ง if .. else ..
// 2. ถ้าคิดเปรียบเทียบ String ต้องใช้ .equals
// 3. ตัวแปรประเภท Comparable นำมาบวกกันไม่ได้
import java.lang.*;
class J0202 {
public static void main(String args[]) {
int x;
x = 6;
if (x > 5) System.out.println("more than 5");
else System.out.println("less than or equal 5");
if (x > 10) System.out.println("more than 10");
else { System.out.println("less than or equal 10"); }
Comparable a[] = new Comparable[5];
a[0] = new Integer(3);
a[1] = new Integer(10);
a[2] = "abc";
System.out.println(a[0] + " " + a[1] + " " + a[2]);
if (a[2].equals("abc")) { System.out.println("equal"); }
if (a[0].compareTo(a[1]) < 0) System.out.print(a[0]); // 3
if (a[1].compareTo(a[0]) > 0) System.out.print(a[0]+""+a[1]); // 310
if (a[0].compareTo(a[0]) == 0) System.out.print("equal"); // equal
System.out.print(a[0].compareTo(a[1])); // -1
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 6
// 1. แสดงการใช้คำสั่ง switch, case, default, break
// 2. available for switch = char, byte, short or int
import java.util.Date;
class J0203 {
public static void main(String args[]) {
byte a = (byte) (new Date().getTime() % 5);
switch (a) {
case 1:
System.out.println("one"); break;
case 2:
System.out.println("two"); break;
default:
System.out.println("not found" + a);
break;
}
}
}
```
 
---
 
# การทำซ้ำ [3]
 
```
// :::: โปรแกรมลำดับที่ 7
// 1. แสดงการใช้คำสั่ง for
// 2. โปรแกรมนี้ใช้ i นอก for ไม่ได้
// 3. ให้พิจารณา .length และ .length()
class J0204 {
public static void main(String args[]) {
System.out.println("ASCII character :: ");
for (int i=0; i<256; i++) {
System.out.print((char)i + " ");
// System.out.println(i);  0 - 255
}
String s = "thaiall";
System.out.println(s + s.length());
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 8
// 1. แสดงการใช้คำสั่ง while แบบเช็คก่อนทำ
// 2. กำหนดค่าเริ่มต้น 1 หรือ 0
// 3. ใช้ (double) ทำให้ผลหารถูกต้อง จึงไม่ catch
class J0205 {
public static void main(String args[]) {
System.out.println("print 1 to 10 :: ");
int i;
i = -5;
while (i <= 5) {
try {
i++;
System.out.println((double)5/i); //Infinity
System.out.println(5/i); //catch ok
}
catch (ArithmeticException e) {
System.out.println("may divide by zero");
}
}
int k = 0;
i = 0;
while (i < 5) {
System.out.print(++k);
k = k + (i++);
System.out.print(k--);
} // 11122447711
}
}
```
 
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 12
// 1. แสดงการรับค่าจากแป้นพิมพ์แบบ character
// 2. รับต่อกันไปเรื่อย ๆ จนรับตัวอักษร 0 เข้าไปจึงหยุด
import java.io.*;
class J0303 {
public static void main(String args[]) throws IOException {
System.out.println("Get until receive 0 [hidden is 13, 10]");
char buf;
do {
buf = (char)System.in.read();
System.out.println("Output is "+buf);
} while (buf != '0');
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 14
// 1. รับตัวเลขไปเรื่อย ๆ ไปแสดงผล จนกระทั่งรับเลข 0
// 2. ใช้ BufferedReader ในการรับข้อมูล
import java.io.*;
class J0305 {
public static void main(String args[]) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String buf;
int i;
System.out.println("Get until receive 0");
do {
buf = stdin.readLine();
i = Integer.parseInt(buf);
System.out.println("Output is "+i);
} while (i != 0);
}
}
```
 
---
 
# หน่วยที่ 4 การควบคุมเหตุการณ์
 
- Exception [1]
- try, catch, finally [2]
 
---
 
# Exception [1]
 
```
class testofexception {
public static void main(String[] args) {
 try  {
  System.out.println(1/0);   
 }
 catch (Exception e)  {
  System.out.println(e);
 }
 // java.lang.ArithmeticException: / by zero
}
}
```
 
---
 
# try, catch, finally [2]
 
```
// ::: โปรแกรมลำดับที่ 9
// 1. แสดงการใช้คำสั่ง do .. while
// 2. ตรวจเงื่อนไขแบบ ทำก่อนเช็ค
// 3. ใช้ try catch จับปัญหา array
class J0206 {
public static void main(String args[]) {
System.out.println("print 1 to 10 :: ");
int i;
i = 1;
try {
do {
System.out.println(i);
i++;
} while (i <= 10);
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("over index of array");
}
}
}
```
 
---
 
# หน่วยที่ 5 คลาส และเมธอด 
 
- method [1]
- class [2]
 
---
 
# method [1]
 
```
// :::: โปรแกรมลำดับที่ 15
// 1. มี 3 method ใน class และเรียกใช้
// 2. ผลคือ xyx ให้นศ.ฝึกสร้าง method
class J0401 {
public static void main(String args[]) {
sub1(); sub2(); sub1();
}
static void sub1() {
System.out.print("x");
}
static void sub2() { System.out.print("y"); }
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 16
// 1. การเขียน method เพื่อรับค่าไปประมวลผล
// 2. ผลของ sum = 140 เพราะอะไร
class J0402 {
public static void main(String args[]) {
int s = 0;
s = sub(2,8,s);
s = sub(7,3,s);
s = sub(4,6,s);
System.out.println("Sum = "+s);
}
public static int sub(int x, int y, int z) {
int a = y + x + z;
return (a + y + x + z);
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 17
// 1. การใช้ method หาค่า 2 เท่า
// 2. ประกาศ method ไม่มี public ก็ได้
class J0403 {
public static void main(String args[]) {
int j = 3;
System.out.println(doubleofnumber(j));
}
static int doubleofnumber(int i) {
i = i * 2;
return (i);
}
}
```
 
---
 
# class [2]
 
```
// :::: โปรแกรมลำดับที่ 18
// 1. สร้าง class ใหม่และเรียก method ใน class ใหม่
// 2. แสดงการใช้ super และ this ใน constructor
// 3. .java แฟ้มหนึ่ง อาจมีได้หลาย class
class sub01 {
void subx() {
System.out.println("subx in sub01");
}
}
class sub02 {
void subx() {
System.out.println("subx in sub02");
}
}
class J0404 extends sub02 {
j0404() {
super.subx(); // subx in sub02
this.subx(); // subx in main
}
public static void main(String args[]) {
sub01 x = new sub01();
System.out.println("main"); // main
x.subx();      // subx in sub01
j0404 y = new j0404();
}
void subx() {
System.out.println("subx in main");
}
}
```
 
---
 
# หน่วยที่ 6 การปกป้อง (Encapsulation)
 
- public [1]
- private [2]
- protected [3]
 
---
 
# public [1]
 
```
public static int cal1() { }
```
 
---
 
# private [2]
 
```
public static int cal2() { }
```
 
---
 
# protected [3]
 
```
public static int cal3() { }
```
 
---
 
# หน่วยที่ 7 การสืบทอด (Inheritance)
 
- constructor [1]
- superclass [2]
- subclass [3]
 
---
 
# constructor [1]
 
```
class Friend {
  String name;
  Integer age;
  Friend(String name,Integer age) {
     this.name = name;
     this.age = age;
  }
}
http://www.thaiall.com/class/oopsam.htm
```
 
---
 
# superclass [2]
 
- superclass (parent) - the class being inherited from
 
```
j0404.java
public class sub01 {
  void subx() { System.out.println("subx in sub01"); }
}
public class sub02 {
  void subx() { System.out.println("subx in sub02"); }
}
public class j0404 extends sub02 {
  j0404() {
    super.subx(); // subx in sub02
    this.subx(); // subx in main
  }
  public static void main(String args[]) {
    sub01 x = new sub01();
    System.out.println("main"); // main
    x.subx();      // subx in sub01
    j0404 y = new j0404();   
  }
  void subx() {
    System.out.println("subx in main");
  }
}
```
 
---
 
# subclass [3]
 
- subclass (child) - the class that inherits from another class
- Vehical คือ Super class ส่วน Car คือ Sub class
- https://www.w3schools.com/java/java_inheritance.asp
 
```
class Vehicle {
  protected String brand = "Ford";        // Vehicle attribute
  public void honk() { System.out.println("Tuut, tuut!"); } // Vehicle method
}
class Car extends Vehicle {
  private String modelName = "Mustang";    // Car attribute
  public static void main(String[] args) {
    Car myCar = new Car(); // Create Object from Car
    myCar.honk(); // Tuut, tuut!
    System.out.println(myCar.brand + " : " + myCar.modelName); // Ford : Mustang
  }
}
```
 
---
 
# หน่วยที่ 8 การพ้องรูป (Polymorphism)
 
- overloading [1]
- overriding [2]
- upcasting [3]
 
---
 
# overloading [1]
 
- https://www.lordgift.in.th/2012/11/overloading-overriding.html
 
```
public class Human {
  public String getName() {
    return "I'm Human";
  }
  public String getName(String firstname, String lastname) {
    return firstname + lastname;
  }
}
```
 
---
 
# overriding [2]
 
- https://www.lordgift.in.th/2012/11/overloading-overriding.html
 
```
public class Human {
  public String getName() {
    return "I'm Human";
  }
}
public class Man extends Human {
  @Overide
  public String getName() {
    return "I'm Man";
  }
}
```
 
---
 
# upcasting [3]
 
- Casting from a subclass to a superclass is called upcasting
- https://www.baeldung.com/java-type-casting
 
 
```
public class Animal {
    public void eat() { }
}
public class Cat extends Animal {
    public void eat() { }
    public void meow() { }
}
// Cat cat = new Cat();
// Animal animal = cat;
// animal = (Animal) cat;
// animal.meow(); The method meow() is undefined for the type Animal
 
```
 
---
 
# downcasting
 
- https://www.baeldung.com/java-type-casting
 
 
```
// Animal animal = new Cat(); // Upcasting
// ((Cat) animal).meow(); // Downcasting คือเรียกใช้ method ใน subclass
public class AnimalFeeder {
  public void feed(List<Animal> animals) {
    animals.forEach(animal -> {
      animal.eat();
        if (animal instanceof Cat) { ((Cat) animal).meow(); }
    });
  }
}
```
 
---
 
# downcasting
 
- http://javainsimpleway.com/upcasting-and-downcasting-in-java/
 
```
Parent p = new Child();
Child c =(Child) p;
```
 
---
 
# หน่วยที่ 9 แพคเกจ (Package)
 
- การสร้าง package [1]
- การเรียกใช้ package [2]
 
---
 
# การสร้าง package [1]
 
- Package คือ การจัดระเบียบคลาส (Class) และอินเทอร์เฟซ (interfaces)
- Package คือ โฟลเดอร์ (Folder) ที่ใช้จัดเก็บ Class และ Interfaces อย่างเป็นหมวดหมู่
 
```
package financeDep;
public class Hello {
    public void sayHello() {
        System.out.println( "Hello, FinanceDep" );
    }
}
// ---
public class myPro {
    public static void main(String args[]){
        financeDep.Hello x = new financeDep.Hello();
        x.SayHello(); // Hello, FinanceDep
    }
}
```
 
---
 
# การเรียกใช้ package [2]
 
- https://www.w3schools.com/java/java_packages.asp
 
```
import java.util.Scanner;
class MyClass {
  public static void main(String[] args) {
    Scanner myObj = new Scanner(System.in);
    System.out.println("Enter username");
    String userName = myObj.nextLine();
    System.out.println("Username is: " + userName);
  }
}
```
 
---
 
# หน่วยที่ 10 เทรด (Thread)
 
- เทรดเดียว [1]
- มัลติเทรด [2]
 
---
 
# เทรดเดียว [1]
 
- http://marcuscode.com/lang/java/thread
 
```
public class ThreadExample {
    public static void main(String[] args){
        Thread t1 = new Thread(new MyThread()); 
        t1.start();
    }
}
class MyThread implements Runnable {
    @Override
    public void run() { System.out.println("Thread is running..."); }
}
```
 
---
 
# มัลติเทรด [2]
 
- http://marcuscode.com/lang/java/thread
 
```
public class ThreadExample {
    public static void main(String[] args){
        for (int i = 0; i < 4; i++) {
            Thread t1 = new Thread(new HelloMessage(i + 1)); 
            t1.start();
        }
    }
}
class HelloMessage implements Runnable {
    public int threadNum;
    public HelloMessage(int threadNum) {
        this.threadNum = threadNum;
    }
    @Override
    public void run() {    
        System.out.println("Hello from thread " + threadNum);   
    }
}
Hello from thread 1
Hello from thread 4
Hello from thread 3
Hello from thread 2
```
 
---
 
# หน่วยที่ 11 การจัดการแฟ้มข้อความ
 
- การสร้างแฟ้มข้อความ [1]
- การอ่านแฟ้มข้อความ [2]
- การเพิ่มรายการ [3]
- การลบรายการ [4]
- การแก้ไขรายการ [5]
 
---
 
# การสร้างแฟ้มข้อความ [1]
 
```
// :::: โปรแกรมลำดับที่ 21
// 1. การแสดงรายละเอียดของแฟ้ม f0601.java
import java.io.*;
class J0601 {
public static void main (String args[]) throws IOException {
File f = new File("j0601.java");
System.out.println("getName: "+f.getName());
System.out.println("getPath: "+f.getPath());
System.out.println("getAbsolutePath: "+f.getAbsolutePath());
System.out.println("exists: "+f.exists());
System.out.println("isFile: "+f.isFile());
System.out.println("isDirectory: "+f.isDirectory());
System.out.println("canWrite: "+f.canWrite());
System.out.println("canRead: "+f.canRead());
System.out.println("length: "+f.length());
File file = new File("hello.txt");
boolean success = file.createNewFile();
File file2 = new File("hello.java");
success = file.renameTo(file2);
File b = new File("c:/");
success = file2.renameTo(new File(b, file2.getName()));
success = (new File("hello.java")).delete();
System.out.println(success); // false
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 22
// 1. ประมวลผล เช่น java j0602 c:\class
// 2. การแสดงรายชื่อแฟ้มจาก Directory ที่กำหนด
import java.io.*;
class J0602 {
public static void main (String args[]) {
File d = new File(args[0]);
String n[] = d.list();
for (int i = 0; i<n.length; i++) {
File f = new File(args[0] + '/' + n[i]);
System.out.println(i+" : "+n[i]+" Size="+f.length());
}
System.out.println("directory: "+d.getPath());
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 24
// 1. เขียนข้อมูลลงไปในแฟ้ม tmp.txt
// 2. create or replace file 256 byte in ascii character
import java.io.*;
class J0604 {
public static void main (String args[]) throws IOException {
FileOutputStream fout = new FileOutputStream("tmp.txt");
for(int i=0;i<256;i++) {
fout.write(i);
}
fout.close();
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 25
// เขียนข้อมูล 10 บรรทัดลงไปในแฟ้ม tmp.txt
import java.io.*;
class J0605 {
public static void main (String args[]) throws IOException {
FileOutputStream fout = new FileOutputStream("tmp.txt");
for(int i=1;i<=10;i++) {
fout.write(i+47);
fout.write(13);
fout.write(10);
}
fout.close();
}
}
```
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 26
// 1. อ่านข้อมูลจากแฟ้ม tmp.txt มาแสดงผล
// 2. ใช้ FileReader
// 3. อ่านข้อมูลมาแสดงบรรทัดละ 1 ตัวอักษร
import java.io.*;
class J0606 {
public static void main (String args[]) throws IOException {
int i = 0, n = 0;
char b[] = new char[1];
FileReader fin = new FileReader("tmp.txt");
while ((n =  fin.read(b)) != -1) {
System.out.println(i+" : "+b[0]);
i = i + 1;
}
fin.close();
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 27
// 1. อ่านข้อมูลจากแฟ้ม tmp.txt มาแสดงผลทีละตัวอักษร
// 2. อ่านข้อมูลเก็บลงอาร์เรย์ และนำจากอาร์เรย์มาแสดงผล
// 3. อ่านข้อมูลมาแสดงบรรทัดละ 16 ตัวอักษร
import java.io.*;
class J0607 {
public static void main (String args[]) throws IOException {
int i = 1, n = 0;
char b[] = new char[16];
FileReader fin = new FileReader("tmp.txt");
while ((n =  fin.read(b)) != -1) {
System.out.print((i-1)*16 + " - " + (i*16-1) + ":");
System.out.print(b[0]+b[1]+b[2]+b[3]+b[4]+b[5]+b[6]+b[7]+b[8]);
System.out.println(b[9]+b[10]+b[11]+b[12]+b[13]+b[14]+b[15]);
i = i + 1;
}
fin.close();
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 28
// 1. อ่านข้อมูลจากแฟ้ม data.txt มาแสดงผล
// 2. ใช้วิธีการอ่านข้อมูลแบบ readlin และ String
import java.io.*;
class J0608 {
public static void main (String args[]) throws IOException {
int i = 1;
String b;
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
// System.out.println(b = bin.readLine()); // output is b
while ((b =  bin.readLine()) != null) {
System.out.println(i + " : " +b);
i = i + 1;
}
System.out.println(b = bin.readLine()); // null
fin.close();
}
}
```
 
---
 
# การอ่านแฟ้มข้อความ [2]
 
```
// :::: โปรแกรมลำดับที่ 23
// อ่านแฟ้ม j0603.java ทีละตัวอักษร มาแสดงผล
import java.io.*;
class J0603 {
public static void main (String args[]) throws IOException {
int n = 0;
byte b[] = new byte[128];
FileInputStream fin = new FileInputStream("j0603.java");
while ((n = fin.read(b)) != -1) {
for(int i=0;i<n;i++) System.out.print((char)b[i]);
}
System.out.println(n = fin.read(b)); // -1
fin.close();
}
}
```
 
---
 
# การเพิ่มรายการ [3]
 
```
// ::: โปรแกรมลำดับที่ 31
// 1. อ่านข้อมูลเก็บลงอาร์เรย์ แล้วนำไปเขียนลงแฟ้ม data.htm
// 2. เพิ่มค่าให้ field เงินเดือนจากเดิมอีก 100 บาท
import java.io.*;
class J0703 {
public static void main (String args[]) throws IOException {
int i = 0,d;
String b;
String[] fields;
String[] recs = {"","",""};
String patternStr = ",";
//
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
//
while ((b =  bin.readLine()) != null) {
recs[i] = b;
i = i + 1;
}
fin.close();
//
FileOutputStream fout = new FileOutputStream("data.htm");
BufferedOutputStream bout = new BufferedOutputStream(fout);
PrintStream pout = new PrintStream(bout);
for(int j=0;j<i;j++) {
fields = recs[j].split(patternStr);
pout.print(fields[0]+","+fields[1]+",");
// pout.print(Double.valueOf(fields[2]).doubleValue());
d = Integer.valueOf(fields[2]).intValue() + 100;
pout.print(d);
pout.println(","+fields[3]);
}
pout.close();
}
}
```
 
---
 
# การลบรายการ [4]
 
 
```
public static void deleteonid () throws IOException {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String bufid;
    System.out.print("Wait id : ");
    bufid = stdin.readLine();
    String b;
    String ar[] = new String[10];
    FileReader fin = new FileReader("updtxt.dat");
    BufferedReader bin = new BufferedReader (fin);
    int i = 0;
    while ((b =  bin.readLine()) != null) {     
      ar[i] = b;
      i = i + 1;
    }   
    fin.close();
    //
    int tot = i;
    FileOutputStream fout = new FileOutputStream("updtxt.dat");
    BufferedOutputStream bout = new BufferedOutputStream(fout);
    PrintStream pout = new PrintStream(bout);
    i = 0;
    while (i < tot) {     
      if (bufid.equals(ar[i].substring(0,3))) {
        System.out.println("Delete : completely");
      } else {
        pout.println(ar[i]);
      }
      i = i + 1;
    }
    pout.close();
  }
```
 
---
 
# การแก้ไขรายการ [5]
 
 
```
// 201,101,P
// 201,102,P
// 201,103,P
// 202,101,P
// 202,104,P
import java.io.*;
import java.lang.*;
import java.lang.String;
import java.util.regex.*;
class editgrade {
  public static void main(String args[]) throws IOException {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String bufsubj,bufid,bufgrade;
    System.out.print("Wait subject : ");
    bufsubj = stdin.readLine();
    System.out.print("Wait id : ");
    bufid = stdin.readLine();
    System.out.print("Wait grade : ");
    bufgrade = stdin.readLine();   
    String b;
    String ar[] = new String[100];
    FileReader fin = new FileReader("grade.txt");
    BufferedReader bin = new BufferedReader (fin);
    int i = 0;
    while ((b =  bin.readLine()) != null) {     
      ar[i] = b;
      i = i + 1;
    }   
    fin.close();
    //
    int tot = i;
    String fld[];
    FileOutputStream fout = new FileOutputStream("grade.txt");
    BufferedOutputStream bout = new BufferedOutputStream(fout);
    PrintStream pout = new PrintStream(bout);
    i = 0;
    while (i < tot) {     
      fld = ar[i].split(",");  
      // System.out.println(fld[0] + fld[1] + bufsubj + bufid);      
      if (bufsubj.equals(fld[0]) && bufid.equals(fld[1])) {
        pout.println(bufsubj + "," + bufid + "," + bufgrade);
        // System.out.println("Change");      
      } else {
        pout.println(ar[i]);
      }
      i = i + 1;
    }
    pout.close();
  }
}
```
 
---
 
# หน่วยที่ 12 การประมวลผลแฟ้มข้อความ
 
- การค้นหาข้อมูล [1]
- การผสานข้อมูล [2]
- การประมวลผลข้อมูล [3]
 
---
 
# การค้นหาข้อมูล [1]
 
```
// :::: โปรแกรมลำดับที่ 33
// 1. รับค่าจากแฟ้มพิมพ์แล้วค้นหาในแฟ้ม data.txt
// 2. ค้นหาด้วย split ถ้าพบผลของ split จะได้มากกว่า 1
import java.io.*;
class J0802 {
public static void main (String args[]) throws IOException {
int found=0;
String b,g = "";
String[] fields;
System.out.println("Wait string and enter");
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
g = stdin.readLine();
String patternStr = g;
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
fields = b.split(patternStr);
if (fields.length > 1) {
fields = b.split(",");
System.out.println(fields[0] + fields[1] + fields[2] + fields[3]);
found = 1;
}
}
if (found == 0) System.out.println("Not found");
fin.close();
}
}
```
 
---
 
# การผสานข้อมูล [2]
 
```
// :::: โปรแกรมลำดับที่ 29
// 1. อ่านข้อมูลจากแฟ้ม data.txt แบบ csv มาแสดงผล
// 101,tom,2000,single
// 102,somchai,5000,married
// 2. คำสั่ง split แยก field ด้วย patternStr
import java.io.*;
class J0701 {
public static void main (String args[]) throws IOException {
int i = 1;
int tot = 0;
String b;
String[] fields;
String patternStr = ",";
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
fields = b.split(patternStr);
System.out.println(i + " : " + fields[0]);
System.out.println("Name : " + fields[1]);
System.out.println("Salary : " + fields[2]);
System.out.println("Status : " + fields[3]);
tot = tot + Integer.parseInt(fields[2]);
i = i + 1;
}
System.out.println("Total : " + tot);
fin.close();
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 30
// 1. อ่านข้อมูลจาก data.txt เขียนลง data.htm
// 2. นำข้อมูลที่ถูกแยกด้วย , เขียนลง table อย่างเป็นระเบียบ
// 3. DOS>explorer data.htm
// 4. ต.ย. <input type=radio onclick={alert("a");}>
import java.io.*;
import java.lang.*;
class J0702 {
public static void main (String args[]) throws IOException {
int i = 1;
String b;
String[] fields;
String patternStr = ",";
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
FileOutputStream fout = new FileOutputStream("data.htm");
BufferedOutputStream bout = new BufferedOutputStream(fout);
PrintStream pout = new PrintStream(bout);
pout.println("<body bgcolor=yellow><table border=1 width=100%>");
while ((b =  bin.readLine()) != null) {
fields = b.split(patternStr);
pout.println("<tr>");
pout.println("<td>"+i+"</td>");
pout.println("<td>"+"ID = " + fields[0]+"</td>");
pout.println("<td>"+"Name = " + fields[1]+"</td>");
pout.println("<td>"+"Salary = " + fields[2]+"</td>");
pout.println("<td>"+"Status = " + fields[3]+"</td>");
pout.println("</tr>");
i = i + 1;
}
pout.println("</table></body>");
fin.close();
pout.close();
}
}
```
 
---
 
# การประมวลผลข้อมูล [3]
 
```
// :::: โปรแกรมลำดับที่ 32
// 1. รับค่าจากแป้นพิมพ์ด้วย System.in.read
// 2. นำไปเลือกข้อมูลในแฟ้ม data.txt แล้วแสดงระเบียนที่ตรง
// 3. ค้นหาด้วย .equals()
import java.io.*;
class J0801 {
public static void main (String args[]) throws IOException {
int found=0;
char buf;
String b,g = "";
String[] fields;
String patternStr = ",";
System.out.println("Wait id and end character with [x]");
buf = (char)System.in.read();
while (buf != 'x') {
g = g + buf;
buf = (char)System.in.read();
}
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
fields = b.split(patternStr);
if (fields[0].equals(g)) {
System.out.println(fields[1]);
found = 1;
}
}
if (found == 0) System.out.println("Not found");
fin.close();
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 34
// 1. อ่านแฟ้ม data.txt และ status array มาเชื่อมกัน
// 2. โดยมีแฟ้มข้อมูล และแฟ้มสถานะภาพ
// 2.1 data.txt : รหัส,ชื่อ,สกุล,สถานภาพ
// 31001,tom,dang,A
// 31002,boy,spy,R
// 31003,big,chem,A
// 2.2 status array : สถานภาพ,คำอธิบายสถานภาพ
// A,Active
// R,Retire
import java.io.*;
class J0901 {
public static void main (String args[]) throws IOException {
int i = 0,t1,t2;
String b,status;
// same as String[] fields;
String fields[];
String[] recs1 = new String[10];
String[] recs2 = {"A,Active","R,Retire"};
String patternStr = ",";
//
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
recs1[i] = b;
i = i + 1;
}
fin.close();
t1 = i;
t2 = recs2.length;
//
for(int j=0;j<t1;j++) {
fields = recs1[j].split(patternStr);
System.out.print(fields[0] + fields[1] + fields[2]+fields[3]);
status = fields[3];
for(int k=0;k<t2;k++) {
fields = recs2[k].split(patternStr);
if (fields[0].equals(status)) {
System.out.println(fields[1]);
}
}
}
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 35
// 1. อ่านแฟ้ม data.txt และ datas.txt มาเชื่อมกัน
// 2. โดยมีแฟ้มข้อมูล และแฟ้มสถานะภาพ (จำกัด 6 ระเบียน)
// 2.1 data.txt : รหัส,ชื่อ,สกุล,สถานภาพ
// 2.2 datas.txt : สถานภาพ,คำอธิบายสถานภาพ
import java.io.*;
class J0902 {
public static void main (String args[]) throws IOException {
int i = 0,t1,t2;
String b,status;
String[] fields;
String[] recs1 = {"","","","","",""};
String[] recs2 = new String[2];
FileReader fin = new FileReader("data.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
recs1[i] = b;
i = i + 1;
}
fin.close();
t1 = i;
i = 0;
//
FileReader fin2 = new FileReader("datas.txt");
BufferedReader bin2 = new BufferedReader (fin2);
while ((b =  bin2.readLine()) != null) {
recs2[i] = b;
i = i + 1;
}
fin2.close();
t2 = i;
//
for(int j=0;j<t1;j++) {
fields = recs1[j].split(",");
System.out.print(fields[0] + fields[1] + fields[2]+fields[3]);
status = fields[3];
for(int k=0;k<t2;k++) {
fields = recs2[k].split(",");
if (fields[0].equals(status)) {
System.out.println(fields[1]);
}
}
}
}
}
```
 
---
 
# หน่วยที่ 13 อาร์เรย์ และการจัดเรียงลำดับ
 
- อาร์เรย์ [1]
- การจัดเตรียมข้อมูล [2]
- การสลับข้อมูล [3]
- การจัดเรียงข้อมูล [4]
 
---
 
# อาร์เรย์ [1]
 
```
// ::: โปรแกรมลำดับที่ 19
// 1. ประกาศอาร์เรย์ และแสดงข้อมูลในอาร์เรย์ทั้งหมด
class J0501 {
public static void main(String args[]) {
int x[] = {4,18,12};
System.out.println("Amount of array = " + x.length);
for (int i = 0; i < x.length; i++) {
System.out.println("element "+i+" = "+x[i]);
}
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 20
// 1. ประกาศอาร์เรย์ 2 มิติ และแสดงข้อมูลในอาร์เรย์
// 2. การเลือกมิติที่ต้องการไปแสดงผล
class J0502 {
public static void main(String args[]) {
String a[][] = new String[2][3];
a[0][0] = "101";
a[0][1] = "102";
a[0][2] = "103";
int i = 0;
a[1][i++] = "tom";  // 1,0
a[1][i++] = "dang"; // 1,1
a[1][i++] = "boy";  // 1,2
for (i = 0; i < a[0].length; i++) {
System.out.println("element of 0,"+i+" = "+a[0][i]);
}
for (i = 0; i < a[1].length; i++) {
System.out.println("element of 1,"+i+" = "+a[1][i]);
}
}
}
```
 
---
 
# การจัดเตรียมข้อมูล [2]
 
```
// data.txt : รหัส,ชื่อ,สกุล,สถานภาพ
// datas.txt : สถานภาพ,คำอธิบายสถานภา
```
 
---
 
# การสลับข้อมูล [3]
 
```
tmp = x[j];
x[j] = x[j-1];
x[j-1] = tmp;
```
 
---
 
# การจัดเรียงข้อมูล [4]
 
```
// ::: โปรแกรมลำดับที่ 36
// 1. นำอาร์เรย์มาเปรียบเทียบ และจัดเรียงแบบ bubble sort
// 2. ข้อมูลในอาร์เรย์เป็นแบบตัวเลข
// 3. การสลับค่า เช่น t = a; a = b; b = t;
class J1001 {
public static void main (String args[]) {
int tmp,x[] = {5,6,1,2,9,12,9,3};
for(int i=1;i<x.length;i++) {
for(int j=x.length-1;j>=i;j--) {
if(x[j-1] > x[j]) {
tmp = x[j];
x[j] = x[j-1];
x[j-1] = tmp;
}
}
}
for(int i=0;i<x.length;i++) {
System.out.println(x[i]);
}
}
}
```
 
---
 
# mypro
 
```
// ::: โปรแกรมลำดับที่ 37
// 1. นำอาร์เรย์มาเปรียบเทียบ และจัดเรียงแบบ bubble sort
// 2. ข้อมูลในอาร์เรย์เป็นแบบ String
// 3. สร้าง function ช่วยในการอ่านข้อมูลจากอาร์เรย์มาพิมพ์
import java.lang.*;
class J1002 {
public static void main (String args[]) {
String tmp,x[] = {"ac","abc","adb","a","aa","acd","a a","a d"};
System.out.println("Before sorting");
prtlist(x);
for(int i=1;i<x.length;i++) {
for(int j=x.length-1;j>=i;j--) {
if(x[j-1].compareTo(x[j])>0) {
tmp = x[j];
x[j] = x[j-1];
x[j-1] = tmp;
}
}
}
System.out.println("After sorting");
prtlist(x);
}
public static void prtlist(String[] x) {
for(int i=0;i<x.length;i++) {
System.out.println(x[i]);
}
}
}
```
 
---
 
# หน่วยที่ 14 แอพเพล็ต (applet)
 
- การพิมพ์ตัวอักษร [1]
- การวาดเส้น [2]
- การตกแต่ง [3]
- การควบคุม [4]
 
---
 
# การพิมพ์ตัวอักษร [1]
 
```
import java.lang.*;
import java.applet.*;
import java.awt.Graphics;
public class Hello2 extends java.applet.Applet {
public void paint(Graphics g){
g.drawString("hello",10,10);
}
}
```
 
---
 
# การวาดเส้น [2]
 
```
// :::: โปรแกรมลำดับที่ 38
// 1. พิมพ์คำว่า test ด้วย Applet
// 2. ห่างซ้าย 10 pixels ห่างจากบน 20 pixels
// 3. ประมวลผลวิธีแรก appletviewer j1101.htm
// 4. ประมวลผลวิธีที่สอง explorer j1101.htm
// <applet code=j1101.class width=200 height=50></applet>
import java.applet.*;
import java.awt.*;
public class J1101 extends java.applet.Applet {
public void paint(Graphics g) {
g.setColor(new Color(240,240,240));
g.drawString("test",10,20);
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 39
// 1. พิมพ์คำว่า 1 - 10 ด้วย Applet
// 2. รับค่าจาก getParameter
// <applet code=j1102.class width=200 height=50>
// <param name=x value=hello></applet>
import java.applet.*;
import java.awt.*;
public class J1102 extends Applet {
int i,j;
String istr,p;
public void init() {
setBackground(Color.yellow);
p = getParameter("x");
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.drawString(p,0,10);
i = 1;
while (i <= 10) {
j = 10 * i;
istr= Integer.toString(i);
g.drawString(istr,72,j); // column = 1 inch
i++;
}
}
}
```
 
---
 
# mypro
 
```
// :::: โปรแกรมลำดับที่ 40
// 1. เส้นตรงเลื่อนลง ด้วย Applet
// 2. จุดแรกห่างซ้าย 5 และห่างบน 10
import java.applet.*;
import java.awt.*;
public class J1103 extends Applet implements Runnable{
Thread timer;
int row = 10;
public void paint(Graphics g) {
row = row + 2;
g.drawLine(5,row,30,row);
}
public void start() {
timer = new Thread(this);
timer.start(); // start clock
}
public void run() {
Thread me = Thread.currentThread();
while (timer == me) {
try {
// try required for sleep (1000 = 1 Second)
Thread.currentThread().sleep(1000);
} catch (InterruptedException e) { }
repaint();
}
}
}
```
 
---
 
# การตกแต่ง [3]
 
```
// :::: โปรแกรมลำดับที่ 41
// 1. Rect = สี่เหลี่ยม Oval = วงรี Arc = เส้นรอบวง
// 2. Oval กว้าง 20 สูง 30
// 3. Arc เริ่มองศาที่ 0 ไปถึงองศา 120
import java.applet.*;
import java.awt.*;
public class J1104 extends Applet {
Image img;
public void init() {
setBackground(Color.green);
img = getImage(getDocumentBase(),"x.gif");
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.drawLine(5,10,30,40);
g.drawRect(50,50,80,80);
g.drawOval(50,50,20,30);
g.setColor(Color.white);
g.fillOval(50,50,20,30); // backgound is white
g.setColor(Color.red);
g.drawArc(40,30,55,55,0,120);
int[] x={0,80,100,5,10};
int[] y={0,50,80,80,30};
g.drawPolygon(x,y,5);
g.drawImage(img, 0, 200, this);
}
}
```
 
---
 
# การควบคุม [4]
 
```
// :::: โปรแกรมลำดับที่ 42
// 1. กดปุ่มแล้วเปลี่ยนการ paint
// 2. ใช้ Button, Label และ TextField
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class J1105 extends Applet implements ActionListener {
Button b1 = new Button("1");
Label l1 = new Label("Hello");
TextField t1 = new TextField("1");
int row = 10;
public void paint(Graphics g) {
row = row + 10;
g.drawLine(5,row,30,row);
}
public void init() {
setBackground(Color.red);
add(l1);
add(b1);
add(t1);
t1.addActionListener(this);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
int intb1 = Integer.parseInt(e.getActionCommand());
intb1 = intb1 + 1;
String s = Integer.toString(intb1);
l1.setText(s);
b1.setLabel(s);
t1.setText(s);
repaint();
}
}
```
 
---
 
# หน่วยที่ 15 กรณีศึกษา
 
- เมนู [1]
- การตรวจสอบสิทธิ์ [2]
- ระบบสมาชิก [3]
- ระบบจัดการข้อมูล [4]
 
---
 
# เมนู [1]
 
```
// :::: โปรแกรมลำดับที่ 43
// 1. เมนู และการรับตัวเลือกแบบ System.in.read
// 2. ใช้ switch เลือกกระทำ สำหรับ 48 คือ 0, 49 คือ 1
import java.io.*;
class J1201 {
public static void main(String args[]) throws IOException {
int buf=49;
while (buf != 51) {
if (buf >= 49 && buf <= 51) {
System.out.println("What is your option?");
System.out.println("1. print 1 to 10");
System.out.println("2. print 'ok'");
System.out.println("3. exit");
}
// buf = (char)System.in.read(); (it have 13 and 10 on enter)
buf = System.in.read();
switch (buf) {
case 49: // character 1
for (int i=1;i<=10;i++) {
System.out.println(i);
}
break;
case 50: // character 2
System.out.println("ok");
break;
case 51: break; // character 3
case 13: break;
case 10: break;
default:
System.out.println("Nothing to do");
break;
}
}
System.out.println("See you again");
}
}
```
 
---
 
# การตรวจสอบสิทธิ์ [2]
 
```
// :::: โปรแกรมลำดับที่ 44
// 1. เมนู และการรับตัวเลือกแบบ stdin.readLine
// 2. ใช้ if เลือกกระทำ แบบอยู่ใน method เดียวกัน
import java.io.*;
class J1202 {
public static void main(String args[]) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String buf=" ";
while (!buf.equals("3")) {
System.out.println("What is your option?");
System.out.println("1. print 1 to 10");
System.out.println("2. print 'ok'");
System.out.println("3. exit");
buf = stdin.readLine();
if (buf.equals("1"))
for (int i=1;i<=10;i++) System.out.println(i);
if (buf.equals("2")) System.out.println("ok");
}
System.out.println("See you again");
}
}
```
 
---
 
# ระบบสมาชิก [3]
 
```
// :::: โปรแกรมลำดับที่ 45
// 1. เมนู และการรับตัวเลือกแบบ stdin.readLine
// 2. ใช้ if เลือกกระทำ แยก method
import java.io.*;
class J1203 {
public static void main(String args[]) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String buf=" ";
while (!buf.equals("3")) {
System.out.println("What is your option?");
System.out.println("1. print 1 to 10");
System.out.println("2. print 'ok'");
System.out.println("3. exit");
buf = stdin.readLine();
if (buf.equals("1")) oho1();
if (buf.equals("2")) { oho2(); }
}
System.out.println("See you again");
}
public static void oho1() {
for (int i=1;i<=10;i++) {
System.out.println(i);
}
}
public static void oho2() {
System.out.println("ok");
}
}
```
 
---
 
# ระบบจัดการข้อมูล [4]
 
```
import java.io.*;
class Pollweb {
public static void main (String args[]) throws IOException {
int i=0;
int questionhave = 14;
int q[] = new int[questionhave];
String b;
String[] fields;
String patternStr = ",";
FileReader fin = new FileReader("pollweb.txt");
BufferedReader bin = new BufferedReader (fin);
while ((b =  bin.readLine()) != null) {
fields = b.split(patternStr);
for (int j=1;j<=questionhave-1;j++)
q[j]+= Integer.parseInt(fields[j]);
i = i + 1;
}
System.out.println("Total questions: " + i);
for (int j=1;j<=questionhave-1;j++)
System.out.println(j+":"+q[j]+" | "+(q[j] * 100 / i)+"%");
fin.close();
}
}
```
 
---
 
# mypro
 
```
class Hello1 {
public static void main(String args[]) {
System.out.println("hello");
}
}
```
 
---
 
# mypro
 
```
class Pyramid01 {
public static void main(String args[]) {
int k = 4;
for (int i=1;i<=k;i++) {
for (int j=2;j<=i;j++) { System.out.print(" "); }
System.out.print(i+""+i);
for (int j=k;j>=(i+1);j--) { System.out.print("**"); }
System.out.println(i+""+i);
} } }
```
 
---
 
# mypro
 
```
class Pyramid02 {
public static void main(String args[]) {
int k = 4;
for (int i=1;i<=k;i++) {
for (int j=i;j<=(i+2);j++) { System.out.print(j); }
for (int j=1;j<=(2+i);j++) { System.out.print("*"); }
System.out.println();
} } }
```
 
---
 
# mypro
 
```
class Pyramid03 {
public static void main(String args[])   {
int k = 4;
for (int i=1;i<=k;i++) {
System.out.print(i+""+(i+4));
for (int j=1;j<=(4+i);j++) {
System.out.print("*");
}
System.out.println();
} } }
```
 
---
 
# mypro
 
```
class Pyramid04 {
public static void main(String args[]) {
int k = 4;
for (int i=1;i<=k;i++) {
for (int j=1;j<=i;j++) { System.out.print("*"); }
for (int j=i;j>=2;j--) { System.out.print(j); }
for (int j=1;j<=i;j++) { System.out.print(j); }
System.out.println();
} } }
```
 
---
 
# การเรียนรู้ในศตวรรษที่ 21 (1/6)
 
- ฟังเพื่อนอาจารย์พูดคุยกันอีกครั้ง เรื่อง ทักษะที่จำเป็นสำหรับการเรียนรู้ในศตวรรษที่ 21
- พบในคู่มือการประกันคุณภาพการศึกษาภายใน 2557 หน้า 66 ep3 ปกชมพู
- พบว่าเลขหน้าไม่ตรงกับเล่ม ed1 ปี 2558 ที่ผมมีอยู่ ที่อยู่ในหน้า 67 ปกม่วง
- [อ่านเพิ่ม คู่มือประกันคุณภาพภายใน](https://qm.kku.ac.th/downloads/hbMUA57ed3.pdf)
- [อ่านเพิ่ม ประกันคุณภาพภายใน](http://www.thaiall.com/iqa)
- [อ่านเพิ่ม thaiall.com/tec/digital_competencies.htm](http://www.thaiall.com/tec/digital_competencies.htm)
- [อ่านเพิ่ม คู่มือพลเมืองดิจิทัล](http://www.thaiall.com/tec/digitalCitizenship-book-ok.pdf)
 
---
 
# ทักษะที่จำเป็นสำหรับการเรียนรู้ในศตวรรษที่ 21 (2/6)
 
1. กลุ่มวิชาหลัก (Core Subjects)
2. กลุ่มทักษะชีวิต และอาชีพ (Live and career skills)
3. กลุ่มทักษะการเรียนรู้และนวัตกรรม (Learning and innovation skills)
4. กลุ่มทักษะสารสนเทศ สื่อ และเทคโนโลยี (Information, media and technology skills)
 
---
 
# ทักษะสำคัญที่คนส่วนใหญ่ให้ความสำคัญมาก (3/6)
 
- **กลุ่มทักษะการเรียนรู้และนวัตกรรม**
 
1. การคิดเชิงวิพากษ์และการแก้ปัญหา (Critical thinking and problem solving)
2. นวัตกรรมและการสร้างสรรค์ (Innovation and creativity)
3. การสื่อสารและความร่วมมือกัน (Communication and collaboration)
 
- **กลุ่มทักษะสารสนเทศ สื่อ และเทคโนโลยี (Information , media and technology skills)**
 
1. การรู้สารสนเทศ (Information Literacy)
2. การรู้สื่อ (Media Literacy)
3. การรู้ ICT (ICT Literacy) (ICT = Information and Communication Technology = เทคโนโลยีสารสนเทศ และการสื่อสาร)
 
- **กลุ่มทักษะชีวิตและอาชีพ (Life and career skills)**
 
1. ความสามารถในการปรับตัวและยืดหยุ่น (Adaptability and flexibility)
2. ความคิดริเริ่มและการเรียนรู้ได้ด้วยตนเอง (Initiative and self-direction)
3. ปฏิสัมพันธ์ทางสังคม และข้ามวัฒนธรรม (Social and cross-cultural interaction)
4. ความรับผิดชอบและความสามารถผลิตผลงาน (Accountability and productivity)
5. ความเป็นผู้นำและรับผิดชอบต่อสังคม (Leadership and social responsibility)
 
---
 
# ทักษะที่จำเป็นสำหรับการเรียนรู้ในศตวรรษที่ 21 (4/6)
 
![หน้า 66 ในคู่มือประกัน](http://www.thaiall.com/iqa/handbook_mua57ed3_p66.png)
 
---
 
# ความเป็นพลเมืองดิจิทัล (5/6)
 
- **ความเป็นพลเมืองดิจิทัล** คือ พลเมืองผู้ใช้งานสื่อดิจิทัลและสื่อสังคมออนไลน์ที่เข้าใจบรรทัดฐาน
ของการปฏิบัติตัวให้เหมาะสม และมีความรับผิดชอบในการใช้เทคโนโลยี
โดยเฉพาะอย่างยิ่งการสื่อสารในยุคดิจิทัลเป็นการสื่อสารที่ไร้พรมแดน
- การเป็นพลเมืองดิจิทัลควรมีทักษะที่สำคัญ 8 ประการ
1. ทักษะในการรักษาอัตลักษณ์ที่ดีของตนเอง (Digital Citizen Identity)
2. ทักษะในการรักษาข้อมูลส่วนตัว (Privacy Management)
3. ทักษะในการคิดวิเคราะห์มีวิจารณญาณที่ดี (Critical Thinking)
4. ทักษะในการจัดสรรเวลาหน้าจอ (Screen Time Management)
5. ทักษะในการรับมือกับการคุกคามทางโลกออนไลน์ (Cyberbullying Management)
6. ทักษะในการบริหารจัดการข้อมูล ที่ผู้ใช้งานมีการทิ้งไว้บนโลกออนไลน์ (Digital Footprints)
7. ทักษะในการรักษาความปลอดภัยของตนเองในโลกออนไลน์ (Cybersecurity Management)
8. ทักษะในการใช้เทคโนโลยีอย่างมีจริยธรรม (Digital Empathy)
- https://www.salika.co/2019/04/03/8-skills-for-digital-citizenship/
- https://thaidigizen.com/wp-content/uploads/2018/06/DigitalCitizenship-Book-ok.pdf
- https://www.thaihealth.or.th/Content/48161-citizen
 
---
 
# ทักษะจำเป็น เพื่อก้าวสู่การเป็นพลเมืองดิจิทัล (6/6)
 
![ความเป็นพลเมืองดิจิทัล](http://www.thaiall.com/tec/digital_citizen_skill.jpg)
 
---
 
# 5 ซอฟต์สกิล และ 5 ฮาร์ดสกิล เพื่อได้งานและรักษางาน
 
- **ทักษะด้านความรู้ / ฮาร์ดสกิล (Hard Skills)** คือ ทักษะด้านความรู้ที่ใช้ในการทำงาน ความสามารถเชิงเทคนิคที่สั่งสอนกันได้ วัดผลการเรียนรู้ วัดความรู้ความสามารถได้ ทักษะด้านอารมณ์ / ซอฟต์สกิล (Soft Skills) คือ ทักษะด้านอารมณ์ที่ใช้ในการอยู่ร่วมกับผู้อื่น รวมถึงการพัฒนาตัวเอง ซึ่งการทำงานในปัจจุบันต้องมีทั้ง Soft Skills และ Hard Skills เพราะการจะได้งานต้องมี Hard Skills แต่การรักษางานไว้แน่น ได้รับการสนับสนุนและทำงานได้อย่างมีความสุขจำเป็นต้องมี Soft Skills
- อ่านจาก **Weforum.org , Linkedin.com และ Nowasu** พบว่า รายงานของ World Economic Forum พูดถึง 10 ทักษะที่บริษัททั่วโลกต้องการ ที่เก็บรวบรวมจากเว็บไซต์จัดหางาน LinkedIn ที่เป็นทักษะของผู้ใช้งานที่ได้รับการว่าจ้างสูงสุด จากสมาชิกของ LinkedIn 100,000 คน แบ่งเป็น 5 Soft Skills ได้แก่ 1) ความคิดสร้างสรรค์ 2) การพูดโน้มน้าวผู้อื่น 3 ) การทำงานร่วมกับผู้อื่น 4 ) การปรับตัว 5 ) การบริหารเวลา 5 Hard Skills ได้แก่ 1) การใช้งานระบบคลาวด์และเครือข่าย 2) การใช้ปัญญาประดิษฐ์ 3) การวิเคราะห์เชิงเหตุผล 4) การบริหารบุคคล 5) การออกแบบประสบการณ์ให้กับผู้ใช้งาน
- [thaiall.com/job/appjob.htm](http://www.thaiall.com/job/appjob.htm)
 
---
 
# 5 ซอฟต์สกิล และ 5 ฮาร์ดสกิล เพื่อได้งานและรักษางาน
 
![ซอฟต์สกิล และ ฮาร์ดสกิล](http://www.thaiall.com/job/5softhardskills.jpg)
 
---
 
#  สุดยอด 3 เรื่องเล่าเร้าพลังใจ
 
1. ไล่ตงจิ้น ลูกขอทานผู้ไม่ยอมแพ้ (thaijo)
2. น็อตตัวละแสน (สิริทัศน์ สมเสงี่ยม)
3. บะหมี่น้ำหนึ่งชาม (คลิ๊ปผมเอง)
 
- http://www.thaiall.com/web2/key.php?topic=beggar_child&dir=ZXRoaWNz&file=aW5kZXguaHRtbA==
- http://www.thaiall.com/ethics/
แนะนำหัวข้อ
MIS: Content, All
KMed: Content, All
Ethics: Content, All
Tec: Content, All
Hci: Content, All
PHP: Content, All
Java: Content, All
PHPJs: Content, All
office_content *
introtocomputer_content
test1
test2
pandoc( x86_64 102MB)
markdown
ารใช้พาวเวอร์พ้อยท์สอนออนไลน์ (Powerpoint Presentation for Teaching)
เครื่องมือหนึ่งที่ได้รับความนิยมในการสอนออนไลน์ คือ พาวเวอร์พ้อยท์ เพื่อควบคุมทิศทาง หัวข้อ ประเด็นที่ต้องการสื่อสาร ให้เห็นข้อความ แผนภาพ เสียง และคลิ๊ปวีดีโอตามแผนการสอนได้อย่างชัดเจน สามารถแทรกเว็บแคมที่มีภาพผู้สอนไปในแต่ละสไลด์ได้ สามารถใช้ได้ทั้งสอนสด (Live) ออกไปทางโปรแกรมสอนออนไลน์เช่น Zoom, Webex, Google Meet หรือ MS Teams หรือบันทึกเป็นคลิ๊ป แล้วให้ผู้เรียนมาเปิดดูได้ในภายหลัง (Video on Demand) ซึ่งมีเครื่องมือบันทึกการสอนผ่านสไลด์อีกมากมาย อาทิ Office Mix, Camtasia, Snagit, OBS Studio หรือ Camstudio (Open source) หรือใช้คุณสมบัติที่มีในพาวเวอร์พ้อยท์ด้วยการคลิ๊กเลือก Menubar, Slide Show, Record Slide Show, Start Recording from Beginning หรือ Start Recording from Current Slide
https://www.presentation-guru.com
ต.ย. การใช้ Pandoc.exe (x86_64) สร้าง pptx
เช่น C:\> pandoc tec_all.md -o tec_all.pptx
rspsocial
ใช้เวลาโหลดเว็บเพจ = 401 มิลลิวินาที สูง = 26214 จุด กว้าง = 1264 จุด
Thaiall.com