TstLin - SCJP smpl 3 Mint fltsor vnég Kérésk szám: 21 kérés Kitöltési iő: 48:36 Pont gység: +6-2 Értéklés: Alpértlmztt értéklés Típus: Minig vn lglá gy jó válsz (N/1..N) Sour: http://sjptst.om 1. A kérés ngyo mint gy önálló oll, zért nm tu mgjlnni. 2. Givn th o. Wht is th rsult? [sour:jv] String tst = "This is tst string"; String[] tokns = tst.split("\s"); Systm.out.println(tokns.lngth); [sour] 1:53 An xption is thrown t runtim Compiltion fils 0 5 21 Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 1/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 3. Givn th o. Wht is th rsult? [sour:jv] puli lss Cruisr implmnts Runnl { puli stti voi min(string[] rgs) throws IntrruptExption { Thr = nw Thr(nw Cruisr());.strt(); Thr 2:25 Systm.out.print("Bgin");.join(); Systm.out.print("En"); puli voi run() { Systm.out.print("Run"); [sour] "BginEn" is print. An xption is thrown t runtim. "BginRunEn" is print. "BginEnRun" is print. Compiltion fils. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó 4. Th o low is xut y "jv -Dmyprop=myprop Tst". Whih two, pl inst of "//som o gos hr", will prou th output "myprop"? (Choos two) [sour:jv] puli lss Tst { puli stti voi min(string rgs[]) { String prop = //som o gos hr// Systm.out.print(prop); [sour] 2:21 f Systm.lo("myprop"); Systm.gt("myprop"); Systm.gtProprtis().gtProprty("myprop"); Systm.gtProprty("myprop"); Systm.gtEnv("myprop"); Systm.proprty("myprop"); Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 2/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 5. Givn th o. Wht is th rsult? [sour:jv] DtFormt f = DtFormt.gtDtInstn(DtFormt.LONG, Lol.US); Clnr = Clnr.gtInstn();.st(Clnr.YEAR, 2009);.st(Clnr.MONTH, 6);.st(Clnr.DAY_OF_MONTH, 1); String formttdt = f.formt(.gttim()); Systm.out.println(formttDt); [sour] 2:12 Compiltion fils An xption is thrown t runtim Jun 1, 2009 July 1, 2009 Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 3/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 6. Givn th o. Wht is th rsult? [sour:jv] import jv.util.hshst; puli lss HshTst { privt String str; puli HshTst(String str) { this.str = str; puli stti voi min(string rgs[]) { HshTst h1 = nw HshTst("1"); HshTst h2 = nw HshTst("1"); String s1 = nw String("2"); String s2 = nw String("2"); HshSt hs = nw HshSt(); hs.(h1); hs.(h2); hs.(s1); hs.(s2); Systm.out.print(hs.siz()); [sour] Hsh 2:43 "4" is print. "2" is print. "3" is print. Compiltion fils. An xption is thrown t runtim. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 4/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 7. Givn th o. Wht is th rsult? [sour:jv] puli lss Tst { privt stti voi ostuff(string str) { int vr = 4; if (vr == str.lngth()) { Systm.out.print(str.hrAt(--vr) + " "); ls { Systm.out.print(str.hrAt(0) + " "); puli stti voi min(string rgs[]) { ostuff(""); ostuff("fg"); ostuff("hi"); [sour] 2:24 f f i h Compiltion fils. f i h An xption is thrown t runtim. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 5/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 8. Givn th o. Wht is th rsult? [sour:jv] puli lss TryM { Intgr A; int ; puli TryM(int ) { this. = A + ; Systm.out.print(this.); puli stti voi min(string rgs[]) { Intgr A = nw Intgr(1); TryM t = nw TryM(A); [sour] 2:21 Th vlu "1" is print A NullPointrExption ours t runtim A NumrFormtExption ours t runtim An IllglSttExpition ours t runtim Compiltion fils us of n rror in lin 5 Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 6/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 9. Wht is tru out ojts rfrn y,, t th lin ll "// som o gos hr"? [sour:jv] lss A { privt B ; puli A() { this. = nw B(this); GC 2:48 lss B { privt A ; puli B(A ) { this. = ; puli lss Tst { puli stti voi min(string rgs[]) { A = nw A(); = null; // som o gos hr [sour] Non of ths ojts r ligil for grg olltion. Only th ojt rfrn y "" is ligil for grg olltion. Only th ojt rfrn y "" is ligil for grg olltion. Only th ojt rfrn y "" is ligil for grg olltion. Th ojts rfrn y n r ligil for grg olltion. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 7/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 10. Givn th o. Wht is th rsult? [sour:jv] puli lss SomClss { privt int vlu = 1; 2:22 puli int gtvlu() { rturn vlu; puli voi hngvl(int vlu) { vlu = vlu; puli stti voi min(string rgs[]) { int = 2; SomClss = nw SomClss();.hngVl(); Systm.out.print(.gtVlu()); [sour] An xption is thrown t runtim "1" is print Compiltion fils "2" is print Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 8/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 11. Givn th o low. This o is run y "jv Tst 1 2 3 4". Wht is th rsult? [sour:jv] puli lss Tst { puli stti voi min(string rgs[]) { for (int i = 1; i < rgs.lngth; i++) { Systm.out.print(i + " "); [sour] 2:05 An xption is thrown t runtim. 1 2 1 2 3 2 3 4 Compiltion fils. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó 12. Wht shoul ll ftr th o low to suggst tht th JVM xpn ffort towr ryling th mmory us y th ojt? (Slt two) [sour:jv] BigOjt = MyFtory.rtBigOjt();.oStuff(); = null; [sour] GC 2:04 Runtim.g() Runtim.gtRuntim().g() Systm.g() Systm.frMmory() Runtim.gtRuntim().frMmory() Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 9/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 13. Givn th o. Wht is th rsult? [sour:jv] puli lss EmptyStringsTst { puli stti ooln isempty(string s) { rturn (s == null s.lngth() == 0); 2:19 puli stti voi min(string rgs[]) { if (isempty(null)) { Systm.out.print("mpty "); ls { Systm.out.print("not_mpty "); [sour] "not_mpty" is print "mpty" is print Compiltion fils An xption is thrown t runtim Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó 14. Givn th o. Wht is th rsult whn this progrm is xut? [sour:jv] puli lss SuprHotl { stti int x[]; Stti 2:40 stti { x[0] = 1; puli stti voi min(string rgs[]) { [sour] ArryInxOutOfBounsExption is thrown IllglSttExption is thrown ExptionInInitilizrError is thrown StkOvrflowExption is thrown Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 10/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 15. Givn th o. Wht is th rsult? [sour:jv] lss Smll { puli Smll() { Systm.out.print(" "); Construtor 1:49 lss Smll2 xtns Smll { puli Smll2() { Systm.out.print(" "); lss Smll3 xtns Smll2 { puli Smll3() { Systm.out.print(" "); puli lss Tst { puli stti voi min(string rgs[]) { nw Smll3(); [sour] Th o runs without output. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 11/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 16. Givn th o. Wht is th rsult ftr th lss TryM xution? [sour:jv] lss A { puli voi oa() { B = nw B();.oB(); Systm.out.print("oA"); 2:52 lss B { puli voi ob() { C = nw C();.oC(); Systm.out.print("oB"); lss C { puli voi oc() { if (tru) throw nw NullPointrExption(); Systm.out.print("oC"); puli lss TryM { puli stti voi min(string rgs[]) { try { A = nw A();.oA(); th (Exption x) { Systm.out.print("rror"); [sour] "oaoboc" is print nothing is print "oboarror" is print "rror" is print "ocoboa" is print Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 12/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 17. Givn th o. Wht is th rsult if NullPointrExption ours t lin 2? [sour:jv] try { //som o gos hr th (NullPointrExption n) { Systm.out.print("1 "); th (RuntimExption r) { Systm.out.print("2 "); finlly { Systm.out.print("3"); [sour] 2:02 f 1 3 1 3 3 1 2 3 1 2 3 Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 13/15 Mint fltsor
TstLin - SCJP smpl 3 Mint fltsor vnég 18. Givn th o. Wht is th rsult? [sour:jv] puli lss Tst { privt stti voi ostuff(string str) { int vr = 4; if (vr == str.lngth()) { Systm.out.print(str.hrAt(vr--) + " "); ls { Systm.out.print(str.hrAt(0) + " "); puli stti voi min(string rgs[]) { ostuff(""); ostuff("fg"); ostuff("hi"); [sour] 2:24 f h f i An xption is thrown t runtim. f i Compiltion fils. h Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó 19. Givn th o. Wht is tru out it? (Choos ll tht pply) [sour:jv] num Stt{ACTIVE, INACTIVE, DELETED [sour] 1:58 Stt.ACTIVE == Stt.INACTIVE is fls Stt.ACTIVE < Stt.INACTIVE is tru Stt.ACTIVE.quls(Stt.ACTIVE) is tru Stt.ACTIVE == Stt.ACTIVE is tru Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 14/15 Mint fltsor
Powr y TCPDF (www.tpf.org) TstLin - SCJP smpl 3 Mint fltsor vnég 20. Givn th o. Wht is th rsult? [sour:jv] DtFormt f = DtFormt.gtDtInstn(); f.stlol(lol.us); Clnr = Clnr.gtInstn();.st(Clnr.YEAR, 2009);.st(Clnr.MONTH, 5);.st(Clnr.DAY_OF_MONTH, 1); String formttdt = f.formt(.gttim()); Systm.out.println(formttDt); [sour] 2:12 July 1, 2009 Jun 1, 2009 Compiltion fils An xption is thrown t runtim Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó 21. Givn th o. Wht is th rsult? [sour:jv] puli stti voi min(string rgs[]) { try { String rr[] = nw String[10]; rr = null; rr[0] = "on"; Systm.out.print(rr[0]); th(nullpointrexption nx) { Systm.out.print("null pointr xption"); th(exption x) { Systm.out.print("xption"); [sour] Exption 1:16 "null pointr xption" is print. Compiltion fils. "on" is print. "xption" is print. Csk tipp Tlán jó Nm válszolok Vlószínűlg jó Biztosn jó TstLin - SCJP smpl 3 oll 15/15 Mint fltsor