plweb 認證平台應用實務(修平)
TRANSCRIPT
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 5/81
Linus Torvalds Linux
h ttp://lwpca.net/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 6/81
PCM an
PCMan BBS 2001
BBS BBS
h ttp://pcman.openfoundry.org/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 7/81
M ark Zuckerberg Facebook
h ttp://www.officesnaps h ots.com/2009/08/13/t h e-new-facebook-office/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 9/81
w ith great po w er there must also
come great responsibility
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 10/81
99
y %ü
y Ôy / / /
/ y E-m ail tungsh@y untec h. edu .twy
http: // www.m is.y untec h. edu .tw/~ tungsh /tungsh.h tm l
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 11/81
W elcome to Java w orld«
h ttp://duke.kenai.com/
16 years old
Fat, not fast
Danger
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 12/81
The Big Issue
h ttp://duke.kenai.com/
200 9/ 04 Or a cle buys S un2010 /04 Go sling left S un /Or a cle2010 /09 SCJP OCP, Java
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 13/81
M ore Duke«
h ttp://duke.kenai.com/h ttp://duke.kenai.com/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 16/81
Java?
y
Glass f ish, JB oss, We bS phe r e , We bLo gic, «y JavaFX, GWT, S tr uts, E JB, S pr ing Fr a m ew ork , ZK, «
y JDBC, JPA, Hibe r na te , «
y E clips e , Net Be ans, Inte lliJ, «y Nutc h, Luce ne , Ha doo p, «
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 17/81
1994 ~ 20 1 0
Ja m e s Go slingy 199 4 ± Java a ppe a r ed
Br uce Ta te say «y Bette r , Fas te r , Ligh te r Java (2004)y Be yond Java (2005)
Java
Java ?!h ttp://nig h th acks.com/roller/jag/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 18/81
Java «
S cr ipt ing (JSR 223)
y AWK, Clojur e , Groo vy, Jas ke ll(Has ke ll),
JavaS cr ipt , J E P, J ud oS cr ipt , Pn uts, Jy thon(Py thon), JR uby(Ruby),
Que r cu s (P HP ), S ISC (S che m e ), Sleep , Tcl
Ann ota tion@ We bS e r vice , @ We bS e r vlet , «
h ttps://scripting.dev.java.net/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 19/81
Java «
Java + S cr ipt ing = J us t Sim ple
Groo vy, S cala, Jy thon, JR uby
« Java
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 20/81
Java?Java java or groo vy or s cala or jython or jr uby
.NET c# or vb or vb.n et or f# or c++.n et or js cr ipt
Linux php or pe r l or python or r uby
h ttp://www.indeed.com/
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 23/81
Java «
public class HelloForLoop {public static main(String argv[]) {
for (int i = 0; I < 10; i++) {System.out.println( i = + i);}
}}
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 24/81
Java «
FOR«
y pu blic class s ta tic«y å m ain «y int Inte ge r «y Sys te m .out .pr intlnt«
Java«
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 25/81
Teach less, learn more«
y üy
y
y
y %üy
y
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 27/81
R TFM google it
site:oracle.com jdk api system
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 32/81
OVE R ?!Java Ho w to P rogr a m , 7 /eThis new ed ition include s all of the cor e ped ag ogic m a te r ial f rom Java How to Program,6/e upd a ted to the f or thcom ing Java S tan dar d E dition 6 ( Java S E 6; code na m ed "Mus tang "). Ch ec k o ut the com plete Table of Contents . Her e' s s om e of the book 's key fea tur es :
U pd ated the entir e book to the new Java S tan da r d E dition 6 ("Mus tang ").
Atte ntion to k ey s oftwar e engin ee r ing comm unity concept s, s uc h as We b2.0 , S O A, we b
s e r vice s , ope n s our ce s oftwar e ,
de sign pa tte r ns ,
m ash up s, r ef a ctor ing an d m any m or e .
Ca r efu lly coor dina ted with our new Java, W eb 2 .0, A jax , an d P rogr amm ing P roject s Res our ce Cente r s .New A jax-ena b led , eve nt-dr ive n we b app lic a tions de ve lopm e nt with
JavaS e r ve r Fa ce sThe s er vlet s an d JSP cha pte r s hav e bee n dropped in f avor o f the new JavaS e r ver Fa ce s (JSF ) tr ea tm e nt.New tools -bas ed app roa ch f or web app lic a tions de ve lopm e nt.New we b s er vice s cha pte r .
New S wing Work e r c lass f or m ultithr e a ded us er inte r f ace s.
New Java de s ktop inte gr a tion (JD IC) fea tur es, s uc h as s plash s c r ee ns an d inte r act ions with the sys te m tr ay.
New Gro up Lay out layout m anag e r .
New
JDBC cha pte r introduce s JDBC 4 an d
us e s the MyS QL an d Java DB da tabas e s .
New J Ta ble s or ting an d f ilte r ing capa bilitie s.
New Java 2D gr a die nt ca pa bilitie s.
S trong tr e a tm e nt of ge ner ics an d gene r ic collect ions.
New app lica tion using Goo gle Ma ps we b s e r vice s .
Java Bluep r ints tec hn ology.New S tr ingB uilde r class.
New Re s our ce Ce nte r s f or E clips e ,
Net Be ans , Java S tud ioCr e a tor 2 , JB u ilde r an d othe r popu lar e nvironm e nts.New cove r ag e of ann ota tions, an d m uc h m or e .
And all the key fea tur e s f rom Java How to Program, 6/e , includ ingCa r efu lly de ve loped obj ect -or iented progr a mm ing pr e s e nta tion fea tur ing an e a r ly class e s an d obj ect s ped ag ogy.E xte nsiv e obj ect -or ie nted p rogr a mm ing cas e s tud ie s.Optional 10 -s ect ion OO D/U ML 2 Autom a ted Te lle r Machine ( ATM)cas e s tud y, includ ing com plete code im ple m enta tion.Optional gr a phics an d GU I cas e s tud y tr a ck.Multitie r , da ta bas e -dr ive n we b a pp lica tion de ve lop m ent.And m uc h m or e .
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 35/81
P LW eb %ü «
y
y Goo gle R
P LWe b 200 Java %üy http: // wiki.plwe b.or g /P LWe b -Java -E xa m ple s
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 36/81
P LW eb«
y
y
y
y Te a ch le ss, le a r n m or e «
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 38/81
P LW eb
Windows 2000 / XP / Vista / 7
Java SD K 6y upd a te 21 ( )
Mode r n bro ws e r s
y Moz illa Fir ef ox 3.6y Goo gle Ch rom e 6.0y Inte r net E xplor e r 8 .0
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 39/81
Java@pl w eb %ü
http: // java. plwe b.or g /
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 40/81
P LW eb TQC+ Java «
Javay
y Java R
yy
y
y
y
y
y
http: // wiki.plwe b.or g /Java
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 41/81
P LW eb TQC+ Java «
Javay
y
y zy
y Collect ion
y
http: // wiki.plwe b.or g /Java
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 42/81
P LW eb TQC+ Java
%üy %üy
y %ü
TQ C+ Java 6 (17)y TQ C+ Java
TQ C+ Java 6 %ü (27)y TQ C+ Java 6 (17) %ü
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 43/81
P LW eb
%ü
h ttp://wiki.plweb.org/PLWeb-Java-Examples
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 44/81
1 class Market{2 static int sEgg = 5, sFruit = 20;3 static int getMoney(int nEgg, int nFruit) {4 return sEgg * nEgg + sFruit * nFruit;5 }6 int getMoney() {
7 return sEgg + sFruit;8 }9 }
2
6
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 45/81
public class Good {public static main (String args[]) {
System.out.println(I love Java!);System.out.println("Java is so good ")
}}
BUG
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 46/81
public class AndToIf {public static void main(String args[]) {System.out.println(andToIf(true, true));System.out.println(andToIf(true, false));System.out.println(andToIf(false, true));System.out.println(andToIf(false, false));
}
static boolean andToIf(boolean b1, boolean b2) {if (b1)
____________;
else return _____;}
} if boo le an b1 , b2 boo le anboo le an (b1 && b2)
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 48/81
nn 999
import java.util.Scanner;public class Factorial {
static Scanner keyboard = new Scanner(System.in);public static void main(String args[]) {
int num1;System.out.print("Input n: ");num1 = keyboard.nextInt();while (num1 != 999) {
System.out.printf("%d = %d\n", num1, fac(num1));System.out.print("Input n: ");num1 = keyboard.nextInt();
}}
static int fac(int n) {if(n == 0) {
return 1;} else {
return (n * fac(n - 1));}
}}
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 50/81
P LW eb
1 + 1 = 22 * 2 = 4
1 + 1 = 22 * 2 = 5
^
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 51/81
«
Javay TQ C+ Java OCP, Java (SCJP ) «
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 52/81
JDK
JD K = Java SD K6.0 upd a te 21
JAV A_ HO ME
CL ASSPA TH
http: // he lp.plwe b.or g /ins talla tion: jdk
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 67/81
P LW eb in the future
We b 2 .0 AP I (e m bedded P LWe b analy tics da ta s our ce )
â (s ocial netw ork ing )ü (e -P or tf olio)
Cloud
Mor e «
W h G i h i
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 68/81
W hy G roovy is much easier
// print 1 to 100
100.times {println it+1}
(1..100).each {println it}
for (i in 1..100) {println i}
1.upto(100) {println it}
1.step(101, 1) {println it}
W h G i h i
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 69/81
W hy G roovy is much easier
// print 1 to 100
100.times {println it+1}
(1..100).each {println it}
for (i in 1..100) {println i}
1.upto(100) {println it}
1.step(101, 1) {println it}
W hy G roovy is much easier
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 70/81
W hy G roovy is much easier
//(1..9).each { x->
(1..9).each { y->
println "${x} * ${y} = ${x*y}"}
}
W hy G roovy is much easier
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 71/81
W hy G roovy is much easierimport org.mortbay.jetty.*import org.mortbay.jetty.servlet.*import groovy.servlet.*import java.io.*import javax.servlet.*import javax.servlet.http.*
@Grab(group = 'org.mortbay.jetty', module = 'jetty-embedded', version = '6.1.0')
class HelloServlet extends HttpServlet {void service(HttpServletRequest req, HttpServletResponse resp) {
resp.writer.println("""<html><body><h1>Hello! World!< / h1>It's real servlet!< / body></ html>""");
}}
def runServer(duration) {def server = new Server(8080)
def context = new Context(server, " / ", Context.SESSIONS);context.resourceBase = "."context.addServlet(HelloServlet, " / ")server.start()sleep durationserver.stop()
}
runServer(10000)
Get jetty-embedded-6.1.0.jar
a utom a tically.
Im ple m e nt Hello S ervlet he r e .
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 73/81
W hy G roovy is much easierclass HelloSpock extends spock.lang.Specification {
def " "() {expect:name.size() == length
where:name | length"Spock" | 5"Kirk" | 4"Scotty" | 10
}}
HelloSpock- FAILED
Condition not satisfied:name.size() == length| | | || 6 | 10
Scotty false
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 76/81
W rite Test C ase in groovy
= new (' ')= new (' ')
..
.
. ()
. ()
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 78/81
G roovy -Javaclass {
def = ' '
def = 1000def = 100def = 100def = 50
def ( ) {=
+ ' '
}def ( ) {
. + ' '. -=
}def () {
+ ' ' + }def ( ) {
println}
}
(Constructor)
(Class Met h ods)
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 79/81
G roovy -Javaclass {
def = ' 'def = 1000def = 100def = 100def = 50
def ( ) {
=+ ' '
}def ( ) {
. + ' '. -=
}def () {
+ ' ' +}def ( ) {
pr intln}
}
= new (' ')
= new (' ')
.
.
.
. ()
. ()
8/8/2019 PLWeb ( )
http://slidepdf.com/reader/full/plweb- 80/81
R un G roovy online
http: // groo vycons ole .a pp s pot.com/