B((#+(0,&,(;-) !"#$"%&&'($)*%($+%$,-)) %(.)/,01('2+,-) ,:) U,V(,&,(;-);#);1,)6;%0D)E%01'(,) /1,)A%>%)BC-;"%0;)6;%0D)E%01'(,) *,0;+",)8<)

Size: px
Start display at page:

Download "B((#+(0,&,(;-) !"#$"%&&'($)*%($+%$,-)) %(.)/,01('2+,-) ,:) U,V(,&,(;-);#);1,)6;%0D)E%01'(,) /1,)A%>%)BC-;"%0;)6;%0D)E%01'(,) *,0;+",)8<)"

Transcription

1 !"#$"%&&'($)*%($+%$,-)) %(.)/,01('2+,-) ,:) B((#+(0,&,(;-) F#&,G#"D)H)36I,JJ41,0D,":)'-).+,)=#>)7K;1?) ;1 )) *,0;+",)8<) A%>%)BC-;"%0;)6;%0D)E%01'(,) 8) U,V(,&,(;-);#);1,)6;%0D)E%01'(,) /1,)A%>%)BC-;"%0;)6;%0D)E%01'(,) 7? 4J%--);%CJ,-) 8? 4#(-;"+0;#"-)%(.)O;1'-P) Q? RM(%&'0).'-I%;01) S? 6;%T0)&,&C,"-) \%01)0J%--)1%-)%)I#'(;,");#)';-)3+('2+,:)I%",(;)'();1,)0J%--);",,) B)0J%--)-;#",-);1,)0#(-;"+0;#")%(.)&,;1#.)0#.,)W#")';-)'(-;%(0,-) /1,)0J%--)%J-#)-;#",-)$&#)!%&,&C,"-) 4#(-;"+0;#"-X) BJJ#0%;,)-I%0,)'();1,)1,%I) ]C^,0;-)%(.);1,'")&,;1#.-X) \%01)#C^,0;)'();1,)1,%I)1%-)%)I#'(;,");#);1,)0J%--);%CJ,)#W)';-).M(%&'0);MI,)3;1,)#(,) ';)G%-)0",%;,.)G';1)>'%)new:?) B)&,;1#.)'(>#0%T#()Oo.m( )P))+-,-)o_-)0J%--);%CJ,);#)O.'-I%;01P);#);1,) %II"#I"'%;,)&,;1#.)0#.,)3&'$1;)'(>#J>,)-,%"01'($)+I);1,)0J%--)1',"%"01M:?) ;1,)#C^,0;)G1#-,)&,;1#.)G%-)'(>#D,.?) Q) S)

2 B()\`%&IJ,) \`%&IJ,)G';1)\`IJ'0';)this)%(.)super! public class Counter {! private int x;! public Counter () { x = 0; public void incby(int d) { x = x + d; public int get() { return x; public class Decr extends Counter {! private int y;! public Decr (int inity) { y = inity; public void dec() { incby(-y); // somewhere in main:! Decr d = new Decr(2);! public class Counter {! private int x;! public Counter () { super(); this.x = 0; public void incby(int d) { this.x = this.x + d; public int get() { return this.x; public class Decr extends Counter {! private int y;! public Decr (int inity) { super(); this.y = inity; public void dec() { this.incby(-this.y); // somewhere in main:! Decr d = new Decr(2);! K) <) 4#(-;"+0T($)%()]C^,0;) BJJ#0%T($)6I%0,)#();1,)F,%I! Decr d = new Decr(2);! boolean equals super();! Decr d = boolean equals extends! extends! 5(>#D'($)%)0#(-;"+0;#"X) )%JJ#0%;,-)-I%0,)W#")%)(,G)#C^,0;)))) ))'();1,)1,%I) )'(0J+.,-)-J#;-)W#")#"")V,J.-)#W)#"")) ))%(0,-;#"-)'();1,)0J%--);",,) ))31,",X)`)#*+)M:) )0",%;,-)%)I#'(;,");#);1,)0J%--)b)) ));1'-)'-);1,)#C^,0;_-).M(%&'0);MI,) )"+(-);1,)0#(-;"+0;#")C#.M)%c,") ))I+-1'($)I%"%&,;,"-)%(.)this)) ))#(;#);1,)-;%0D) =#;,X)V,J.-)-;%";)G';1)%) O-,(-'CJ,P).,W%+J;) ))d))9))w#")(+&,"'0)>%j+,-) ))d)null W#")",W,",(0,-)) a) H)

3 4%JJ'($)super! BC-;"%0;)6;%0D)E%01'(,) super();! Decr d = boolean equals super();! this.x = 0;! Decr d = boolean equals 4%JJ);#)superX) )/1,)0#(-;"+0;#")3'&IJ'0';JM:)0%JJ-) ));1,)-+I,")0#(-;"+0;#") )U,&,&C,");1%;)'(>#D'($)%)) ))&,;1#.N0#(-;"+0;#")I+-1,-);1,)) ))-%>,.)G#"D-I%0,@);1,)&,;1#.)) ))I%"%&-)3(#(,)1,",:)%(.)%)(,G)) ))this I#'(;,"?) 3U+(('($)]C^,0;_-).,W%+J;) 0#(-;"+0;#")#&'f,.?:) e) 79) B--'$('($);#)%)L',J.) B--'$('($);#)%)L',J.) this.x = 0;! Decr d = boolean equals.x = 0;! Decr d = boolean equals B--'$(&,(;)'(;#);1,)this.x V,J.) $#,-)'();G#)-;,I-X) ))d)j##d)+i);1,)>%j+,)#w);1'-)'();1,)) ))))-;%0D) ))d)g"';,);#);1,)o`p)-j#;)#w);1%;)) ))))#C^,0;?) B--'$(&,(;)'(;#);1,)this.x V,J.) $#,-)'();G#)-;,I-X) ))d)j##d)+i);1,)>%j+,)#w);1'-)'();1,)) ))))-;%0D) ))d)g"';,);#);1,)o`p)-j#;)#w);1%;)) ))))#C^,0;?) 77) 78)

4 R#(,)G';1);1,)0%JJ) 4#(T(+'($) ;! Decr d = boolean equals Decr d = boolean equals R#(,)G';1);1,)0%JJ);#)O-+I,"P@)-#) I#I);1,)-;%0D);#);1,)I",>'#+-)) G#"D-I%0,?) 4#(T(+,)'();1,)Decr 0J%--_-) 0#(-;"+0;#"?) 7Q) 7S) BC-;"%0;)6;%0D)E%01'(,) B--'$('($);#)%)V,J.) this.y = 2;! Decr d = boolean equals this.y = 2;! Decr d = boolean equals B--'$(&,(;)'(;#);1,)this.y V,J.?) 3/1'-)",%JJM);%D,-);G#)-;,I-)%-)G,) -%G),%"J',"@)C+;)G,_",)-D'II'($) -#&,)W#");1,)-%D,)#W)C",>';Mg:) 7K) 7<)

5 R#(,)G';1);1,)0%JJ) U,;+"('($);1,)=,GJM)4#(-;"+0;,.)]C^,0;) ;! Decr d = boolean equals Decr d = ;! boolean equals R#(,)G';1);1,)0%JJ);#);1,)Decr 0#(-;"+0;#"@)-#)I#I);1,)-;%0D)%(.) ",;+"();#);1,)-%>,.)G#"D-I%0,@) ",;+"('($);1,)(,GJM)%JJ#0%;,.) #C^,0;)3(#G)'();1,)this)I#'(;,":?) 4#(T(+,),`,0+T($);1,)I"#$"%&?) 7a) 7H) BJJ#0%T($)%)J#0%J)>%"'%CJ,) RM(%&'0)R'-I%;01X)L'(.'($);1,)4#.,).dec();! boolean equals boolean equals BJJ#0%;,)%)-;%0D)-J#;)W#");1,)J#0%J) >%"'%CJ,).?))5;_-)&+;%CJ,g)3-,,);1,) C#J.)C#`)'();1,).'%$"%&:?) B-'.,X)-'(0,@)CM).,W%+J;@)V,J.-)%(.) J#0%J)>%"'%CJ,-)%",)&+;%CJ,@)G,) &%M)#&';);1,)C#J.)C#`,-)%(.)^+-;) %--+&,);1,)0#(;,(;-)0%()C,) &#.'V,.?) 7e) 5(>#D,);1,).,0)&,;1#.)#();1,) #C^,0;?))/1,)0#.,)0%()C,)W#+(.)CM) OI#'(;,")01%-'($P?)) )/1'-)I"#0,--)'-)0%JJ,.)+,*#-.!% +.$/#&!0%b)G1'01)0#.,)'-)"+().,I,(.-)#();1,).M(%&'0);MI,)#W) ;1,)#C^,0;?))35();1'-)0%-,@)Decr?:) 6,%"01);1"#+$1);1,) &,;1#.-)#W);1,)Decr@) 0J%--);"M'($);#)V(.)#(,)) 0%JJ,.)dec?) 89)

6 RM(%&'0)R'-I%;01X)L'(.'($);1,)4#.,) U,%.'($)B)L',J._-)4#(;,(;-) this.incby(-this.y);! this.incby(-.y);! boolean equals boolean equals 0+"",(;)G#"D-I%0,)%(.)I+-1'($);1,) this I#'(;,")%(.)%(M)%"$+&,(;-) 3(#(,)'();1'-)0%-,:?) U,%.)W"#&);1,)y)-J#;)#W);1,)#C^,0;?) 87) 88) *##D+I) this.incby(-2);!.incby(-2);! boolean equals boolean equals 5(>#D,);1,)incBy &,;1#.)#();1,) #C^,0;)>'%).M(%&'0).'-I%;01?) 8Q) 6,%"01);1"#+$1);1,) '&IJ,&,(;%T#()0#.,?) 0J%--);"M'($);#)V(.)#(,)) /1,)-,%"01)'-)$+%"%(;,,.);#) 0%JJ,.)incBy?) -+00,,.)b)A%>%_-)-;%T0);MI,)-M-;,&) 3",0+"-'>,JM:)-,%"01);1,) I%",(;)0J%--?) 8S)

7 U+(('($);1,)C#.M)#W)incBy! Bc,")%)W,G)&#",)-;,I-g! this.x = this.x + d;! this.x = -2;! -2 x! -2! 0 boolean equals x! -2 boolean equals 5;);%D,-)%)W,G)-;,I-g) h#.m)#w)incby:) )d)",%.-)this.x! )d)j##d-)+i) )d)0#&i+;,-)",-+j;)this.x + )d)-;#",-);1,)%(-g,")3d8:)'())this.x! =#G)+-,).M(%&'0).'-I%;01);#)'(>#D,);1,) get)&,;1#.)w#").?)/1'-)'(>#j>,-) -,%"01'($)+I);1,)0J%--);",,)%$%'(g) 8K) 8<) Bc,")M,;)%)W,G)&#",)-;,I-g! ;! x! -2 x! -2 boolean equals R#(,i))3!1,Gi:) 6+&&%"MX)this)%(.).M(%&'0).'-I%;01) Y1,()#C^,0;_-)&,;1#.)'-)'(>#D,.@)%-)'()o.m()@);1,)0#.,);1%;)"+(-)'-).,;,"&'(,.)CM)o_-)+,*#-.!%;MI,?) /1,).M(%&'0);MI,@)G1'01)'-)^+-;)%)I#'(;,");#)%)0J%--@)'-)'(0J+.,.)'();1,)#C^,0;) -;"+0;+",)'();1,)1,%I?) 5W);1,)&,;1#.)'-)'(1,"';,.)W"#&)%)-+I,"0J%--@).,;,"&'('($);1,)0#.,)W#")m)&'$1;) ",2+'",)-,%"01'($)+I);1,)0J%--)1',"%"01M)>'%)I#'(;,"-)'();1,)0J%--);%CJ,?) /1'-)I"#0,--)'-)0%JJ,.)+,*#-.!%+.$/#&!0?) ](0,);1,)0#.,)W#")&)1%-)C,,().,;,"&'(,.@)%)C'(.'($)W#")this)'-)I+-1,.) #(;#);1,)-;%0D?) /1,)this)I#'(;,")'-)+-,.);#)",-#J>,)V,J.)%00,--,-)%(.)&,;1#.)'(>#0%T#(-) '(-'.,);1,)0#.,?) 8a) 8H)

8 6;%T0)E,&C,"-) 4J%--,-)'()A%>%)0%()%J-#)%0;)%-)!2*&#.*(1$%W#")0#.,)%(.).%;%?) /1,)&#.'V,")static))&,%(-);1%;);1,))V,J.)#")&,;1#.)'-) %--#0'%;,.)G';1);1,)0J%--)%(.)*2&)'(-;%(0,-)#W);1,)0J%--?) j#+)0%().#)%)-;%t0)%--'$(&,(;)) ;#)'('T%J'[,)%)-;%T0)V,J.?)) public class C {! public static int x = 23;! public static int somemethod(int y) { return C.x + y; public static void main(string args[]) {!! C.x = C.x + 1;! C.someMethod(17);! B00,--);#);1,)-;%T0)&,&C,")+-,-);1,)0J%--)(%&,) C.x)#")C.foo())) 8e) B--#0'%;,.)G';1)C! /1,)0J%--);%CJ,),(;"M)W#") C)1%-)%)V,J.)-J#;)W#")x?) ki.%;,-);#)c.x))&#.'wm) ;1,)0#(;,(;-)#W);1'-) -J#;X))C.x = 17;! C! static x! 23 static int somemethod(int y) { return x + y; static void main(string args[]) { B)-;%T0)V,J.)'-)%)3"2'#")>%"'%CJ,)) /1,",)'-)#(JM)#(,)1,%I)J#0%T#()W#")';)3'();1,)0J%--);%CJ,:) E#.'V0%T#(-);#)-+01)%)V,J.)%",)$J#C%JJM)>'-'CJ,)3'W);1,)V,J.)'-)I+CJ'0:) k-,)g';1)0%+t#(i) Q9) 6;%T0)E,;1#.-)3R,;%'J-:) 6;%T0)&,;1#.-).#)*2&)1%>,)%00,--);#);1,)this)I#'(;,")) Y1Ml)))/1,",)'-(_;)%()'(-;%(0,);#).'-I%;01);1"#+$1?) /1,",W#",@)-;%T0)&,;1#.-)&%M)#(JM).'",0;JM)0%JJ)#;1,")-;%T0)&,;1#.-?) 6'&'J%"JM@)-;%T0)&,;1#.-)0%()#(JM).'",0;JM)",%.NG"';,)-;%T0)V,J.-?) ]W)0#+"-,)%)-;%T0)&,;1#.)0%()0",%;,)'(-;%(0,)#W)#C^,0;-)3>'%)new:)%(.) ;1,()'(>#D,)&,;1#.-)#();1#-,)#C^,0;-?) \`%&IJ,)#W)6;%T0-) /1,)^%>%?J%($?E%;1)J'C"%"M)I"#>'.,-)-;%T0)V,J.-N&,;1#.-)W#")&%(M) 0#&&#()%"';1&,T0)#I,"%T#(-X) Math.PI == ! Math.sin, Math.cos! Math.sqrt! Math.pow!,;0?) m#;01%x)5;)'-)i#--'cj,)3c+;)0#(w+-'($:);#)'(>#d,)%)-;%t0)&,;1#.) %-);1#+$1)';)C,J#($-);#)%()#C^,0;)'(-;%(0,?),?$?))))o.someMethod(17)))))G1,",)someMethod)'-)-;%T0) \0J'I-,)G'JJ)'--+,)%)G%"('($)'W)M#+);"M);#).#);1'-?) Q7) Q8)

9 B)6+C0J%--)0%()45(11.+()';-)!%",(;) public class C {! public void printname() { System.out.println( I m a C ); ]>,""'.'($) public class D extends C {! public void printname() { System.out.prinln( I m a D ); C c = new D();! c.printname(); // what gets printed?! ]+")&#.,J)W#").M(%&'0).'-I%;01)%J",%.M),`IJ%'(-)G1%;)G'JJ)1%II,()G1,() G,)"+();1'-)0#.,?) k-,w+j)w#")01%($'($);1,).,w%+j;)c,1%>'#")#w)0j%--,-?) h+;g)0%()c,)0#(w+-'($)%(.).'n0+j;);#)",%-#()%c#+;)'w)(#;)+-,.)0%",w+jjm?) QQ) QS) R%($,"-)#W)]>,""'.'($) public class C {! public void printtest() {! if (test()) { System.out.println( passed ); }! else { System.out.prinln( failed ); public boolean test() { return true; public class D extends C {! public boolean test() { return false; C c = new D();! c.printtest(); // what gets printed?! /1,)C)0J%--)&'$1;)C,) '()%(#;1,")I%0D%$,@)#")%)) J'C"%"M???) Y1#,>,")G"#;,)D)&'$1;) (#;)C,)%G%",)#W);1,) '&IJ'0%T#(-)#W)) 01%($'($)test?) Y1,()/#)]>,""'.,l) ](JM)#>,""'.,)&,;1#.-)G1,();1,)I%",(;)0J%--)'-).,-'$(,.)-I,0'V0%JJM);#) -+II#";)-+01)&#.'V0%T#(-X) 5W)M#+_",)G"'T($);1,)0#.,)W#")C#;1);1,)I%",(;)%(.)01'J.)0J%--)3%(.)G'JJ)&%'(;%'() 0#(;"#J)#W)C#;1)I%";-)%-);1,)-#cG%",),>#J>,-:)';)&'$1;)C,)]o);#)#>,"""'.,?) 5W);1,)J'C"%"M).,-'$(,")-I,0'V0%JJM).,-0"'C,-);1,)C,1%>'#"%J)0#(;"%0;);1%;);1,) I%",(;)&,;1#.-)%--+&,)%C#+;)#>,""'..,()&,;1#.-)3%(.);1,)01'J.)W#JJ#G-);1%;) 0#(;"%0;:?) \';1,")G%MX).#0+&,(;);1,).,-'$(?) *##D)W#")#;1,")&,%(-)#W)%01',>'($);1,).,-'",.)#+;0#&,X) k-,)0#&i#-'t#()p).,j,$%t#()3'?,?)g"%ii,")#c^,0;-:)"%;1,");1%()#>,""'.'($?) ]>,""'.'($);1,)test)&,;1#.)0%()0%+-,);1,)C,1%>'#")#W)printTest);#) 01%($,i) ]>,""'.'($)0%()C",%D)'(>%"'%(;-N%C-;"%0T#(-)",J',.)+I#()CM);1,)-+I,"0J%--?) QK) Q<)

10 /1,)Winal)&#.'V,") #>,""'..,(q?)) /1,)final)&#.'V,")01%($,-);1%;?) L'(%J)V,J.-)%(.)J#0%J)>%"'%CJ,-X) E+-;)C,)'('T%J'[,.)3,';1,")CM)%)-;%T0)'('T%J'[,")#")'();1,)0#(-;"+0;#":)%(.) 0%((#;);1,",%c,")C,)&#.'V,.?) B0;)J'D,);1,)'&&+;%CJ,)(%&,)C'(.'($-)'()]4%&J) static final V,J.-)%",)+-,W+J)W#").,V('($)0#(-;%(;-)3,?$?)Math.PI:) L'(%J)&,;1#.-)!#**2&)C,)#>,""'..,()'()-+C0J%--,-?) BJ-#)+-,W+J)'()0#&C'(%T#()G';1)static!!",>,(;-)-+C0J%--,-)W"#&)01%($'($);1,)OC,1%>'#"%J)0#(;"%0;P)C,;G,,() &,;1#.-)CM)#>,""'.'($?) BJ'%-'($)%(.)E+;%T#()'()A%>%) /1'-)'-);1,)-%&,)-;#"M)%-)'()]4%&J?) '(%.>,";,(;JM)+-'($);1'-)OW,%;+",P?) Qa) QH) \`%&IJ,)*'-;)4#.,) public class Node {! public int elt;! public Node next;! public Node(int elt, Node next) {! this.elt = elt;! this.next = next;! Node n1 = new Node(1,null);! Node n2 = new Node(2,n1);! Node n3 = n2;! n3.next.next = n2;! Node n4 = new Node(4,n1.next);! n2.next.elt = 17;! Y1%;)'-);1,)V(%J)-;%;,)#W);1,)-;%0D)p)1,%I)%c,")"+(('($);1'-)I"#$"%&l) 3'$(#"'($);1,)G#"D-I%0,)%(.)0J%--);%CJ,:) 6;%0D) n1! n2! n3! B(-G,") F,%I) Node! elt! 17 next! n4! Node! elt! 2 next! Node! elt! 4 next! Qe) S9)

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 26 March 23, 2016 Inheritance and Dynamic Dispatch Chapter 24 Inheritance Example public class { private int x; public () { x = 0; } public void incby(int

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 26 November 3, 2017 The Java ASM, Java Generics Chapter 24 Announcements HW7: Chat Server Available on Codio / InstrucNons on the web site Due Tuesday,

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 31 April 3, 2013 Overriding, Equality, and Casts Announcements HW 09 due Tuesday at midnight More informajon about exam 2 available on Friday Unfinished

More information

JAVA Programming Language Homework II Student ID: Name:

JAVA Programming Language Homework II Student ID: Name: JAVA Programming Language Homework II Student ID: Name: 1. Given the following Java code: 1. class A { 2. public static void main (String[] args) { 3. Byte tmp1 = new Byte( 1 ); 4. Byte tmp2 = new Byte(

More information

CD _. _. 'p ~~M CD, CD~~~~V. C ~'* Co ~~~~~~~~~~~~- CD / X. pd.0 & CD. On 0 CDC _ C _- CD C P O ttic 2 _. OCt CD CD (IQ. q"3. 3 > n)1t.

CD _. _. 'p ~~M CD, CD~~~~V. C ~'* Co ~~~~~~~~~~~~- CD / X. pd.0 & CD. On 0 CDC _ C _- CD C P O ttic 2 _. OCt CD CD (IQ. q3. 3 > n)1t. n 5 L n q"3 +, / X g ( E 4 11 " ') $ n 4 ) w Z$ > _ X ~'* ) i 1 _ /3 L 2 _ L 4 : 5 n W 9 U~~~~~~ 5 T f V ~~~~~~~~~~~~ (Q ' ~~M 3 > n)1 % ~~~~V v,~~ _ + d V)m X LA) z~~11 4 _ N cc ', f 'd 4 5 L L " V +,

More information

More types, Methods, Conditionals. ARCS Lab.

More types, Methods, Conditionals. ARCS Lab. More types, Methods, Conditionals ARCS Lab. Division Division ( / ) operates differently on integers and on doubles! Example double a = 5.0/2.0; 0; // a = 2.5 int b = 4/2; // b = 2 int c = 5/2; // c =

More information

CS101 Quiz No. 4 Nov. 30 & Dec. 1, 2015 Student Name: Kadir Can Çelik (Extended on Dec. 6, 2015)

CS101 Quiz No. 4 Nov. 30 & Dec. 1, 2015 Student Name: Kadir Can Çelik (Extended on Dec. 6, 2015) CS101 Quiz No. 4 Nov. 30 & Dec. 1, 2015 Student Name: Kadir Can Çelik (Extended on Dec. 6, 2015) CS101 Quiz No. 4 Nov. 30 & Dec. 1, 2015 Student Name: Kadir Can Çelik 1. Create a class called Circle with

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 24 October 29, 2018 Arrays, Java ASM Chapter 21 and 22 Announcements HW6: Java Programming (Pennstagram) Due TOMORROW at 11:59pm Reminder: please complete

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 25 March 18, 2013 Subtyping and Dynamic Dispatch Announcements HW07 due tonight at midnight Weirich OH cancelled today Help your TAs make the most

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 26 March 26, 2015 Inheritance and Dynamic Dispatch Chapter 24 public interface Displaceable { public int getx(); public int gety(); public void move

More information

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below. C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What

More information

SPAREPARTSCATALOG: CONNECTORS SPARE CONNECTORS KTM ART.-NR.: 3CM EN

SPAREPARTSCATALOG: CONNECTORS SPARE CONNECTORS KTM ART.-NR.: 3CM EN SPAREPARTSCATALOG: CONNECTORS ART.-NR.: 3CM3208201EN CONTENT SPARE CONNECTORS AA-AN SPARE CONNECTORS AO-BC SPARE CONNECTORS BD-BQ SPARE CONNECTORS BR-CD 3 4 5 6 SPARE CONNECTORS CE-CR SPARE CONNECTORS

More information

1.1 Your First Program

1.1 Your First Program 1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2008 January 26, 2009 9:28 tt Why Programming? Idealized computer. "Please

More information

Bucket Sort Puzzlers. 08 A: Sorting IV. CS1102S: Data Structures and Algorithms. Martin Henz. March 12, 2010

Bucket Sort Puzzlers. 08 A: Sorting IV. CS1102S: Data Structures and Algorithms. Martin Henz. March 12, 2010 08 A: Sorting IV CS1102S: Data Structures and Algorithms Martin Henz March 12, 2010 Generated on Friday 12 th March, 2010, 11:26 CS1102S: Data Structures and Algorithms 08 A: Sorting IV 1 1 2 CS1102S:

More information

SPARE CONNECTORS KTM 2014

SPARE CONNECTORS KTM 2014 SPAREPARTSCATALOG: // ENGINE ART.-NR.: 3208201EN CONTENT CONNECTORS FOR WIRING HARNESS AA-AN CONNECTORS FOR WIRING HARNESS AO-BC CONNECTORS FOR WIRING HARNESS BD-BQ CONNECTORS FOR WIRING HARNESS BR-CD

More information

I. True/False: (2 points each)

I. True/False: (2 points each) CS 102 - Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2004 What is your name?: (0 points) There are two sections: I. True/False..............52 points; ( 26 questions, 2 points each) II.

More information

More Java Basics. class Vector { Object[] myarray;... //insert x in the array void insert(object x) {...} Then we can use Vector to hold any objects.

More Java Basics. class Vector { Object[] myarray;... //insert x in the array void insert(object x) {...} Then we can use Vector to hold any objects. More Java Basics 1. INHERITANCE AND DYNAMIC TYPE-CASTING Java performs automatic type conversion from a sub-type to a super-type. That is, if a method requires a parameter of type A, we can call the method

More information

PQ R :R3 R. &R% R0 $D R6 *9R 8 ND $ S T R

PQ R :R3 R. &R% R0 $D R6 *9R 8 ND $ S T R 6770 +,- () % * $% & #! "#.3 (&). /0 $ + 5% 6 37 % 8 "% 9 /0 &% : ;.< /0 + /0 % * +.= >? :3 (@ /A! /B $0CD &.) 0@ *%$ 8 G7 / +9 9 /B : #. EBA 0 *.F *#. 0 AA< &.) 5% @8 @ % JA @ %B :G, H7 37,A 9 /0 &% /K),

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 27 March 28, 2018 Java Generics Collections and Equality Chapters 25 & 26 Announcements HW7: Chat Server Available on Codio / Instructions on the web

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 25 November 1, 2017 Inheritance and Dynamic Dispatch (Chapter 24) Announcements HW7: Chat Client Available Soon Due: Tuesday, November 14 th at 11:59pm

More information

N11 = 100 MBH Input Aluminized Steel S13 = 125 MBH Input Stainless Steel E15 = 15 kw Electric Heat. E30 = 30 kw Electric Heat

N11 = 100 MBH Input Aluminized Steel S13 = 125 MBH Input Stainless Steel E15 = 15 kw Electric Heat. E30 = 30 kw Electric Heat PRODUCT NOMENCLAUTRE D L -4 N07 A T A A A 1 DIGIT Model Description Options 1 D Product Category D = Air Conditioner, Single Package 2 3-5 L -4 Product Identifier Nominal Cooling Capacity MBH L = R-22

More information

Genstandsfortællinger fra Museum Wormianum til de moderne museer Mordhorst, Camilla

Genstandsfortællinger fra Museum Wormianum til de moderne museer Mordhorst, Camilla Genstandsfortællinger fra Museum Wormianum til de moderne museer Mordhorst, Camilla Publication date: 2003 Citation for published version (APA): Mordhorst, C. (2003). Genstandsfortællinger: fra Museum

More information

Visual Programming. Lecture 2: More types, Methods, Conditionals

Visual Programming. Lecture 2: More types, Methods, Conditionals Visual Programming Lecture 2: More types, Methods, Conditionals Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Outline Lecture 1 Review More types Methods Conditionals 2 Outline Lecture 1 Review More types

More information

CS 102 / CS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2010

CS 102 / CS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2010 CS 102 / CS 107 - Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2010 What is your name?: There are two sections: I. True/False..................... 60 points; ( 30 questions, 2 points each)

More information

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between

More information

KLIC-DI VRV PRODUCT MANUAL INTERFACE KNX DAIKIN VRV ZN1CL-KLIC-DI. Edition 4 Version 1.0

KLIC-DI VRV PRODUCT MANUAL INTERFACE KNX DAIKIN VRV ZN1CL-KLIC-DI. Edition 4 Version 1.0 PRODUCT MANUAL KLIC-DI VRV INTERFACE KNX VRV ZN1CL-KLIC-DI Edition 4 Version 1.0 Index 1. Introduction... 3 2. Installation... 5 2.1. KLIC-DI Installation... 5 2.2. Elements Description... 6 3. Configuration...

More information

RobotPlanning.java Page 1

RobotPlanning.java Page 1 RobotPlanning.java Page 1 import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; * * RobotPlanning - 1030 GUI Demonstration.

More information

Midterm 2 A. 10 Questions. While some questions may seem familiar to practice problems, there are likely to be subtle

Midterm 2 A. 10 Questions. While some questions may seem familiar to practice problems, there are likely to be subtle Name email Midterm 2 A 10 Questions. While some questions may seem Midterm familiar 2 to A practice problems, there are likely to be subtle 10 Questions. While some questions may seem familiar to practice

More information

Linked Lists. private int num; // payload for the node private Node next; // pointer to the next node in the list }

Linked Lists. private int num; // payload for the node private Node next; // pointer to the next node in the list } Linked Lists Since a variable referencing an object just holds the address of the object in memory, we can link multiple objects together to form dynamic lists or other structures. In our case we will

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 29 April 3, 2014 Overriding, Enums, Iterators public class Ref { private T contents; public void add(t e) { contents = e; Quiz (on paper) public

More information

JAVA Programming Language Homework I - Nested Class

JAVA Programming Language Homework I - Nested Class JAVA Programming Language Homework I - Nested Class Student ID: Name: 1. Which two statements are true about has-a and is-a relationships? (choose two) A. Inheritance represents an is-a relationship. B.

More information

CPSC-112 Introduction to Programming

CPSC-112 Introduction to Programming CPSC-112 Introduction to Programming StdAudio and Object-Oriented Programming Friday, March 28th 2014 StdAudio StdAudio Sound is the perception of vibrations in our eardrums. Digital Audio Digital audio

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 28 March 30, 2016 Collections and Equality Chapter 26 Announcements Dr. Steve Zdancewic is guest lecturing today He teaches CIS 120 in the Fall Midterm

More information

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes COMP200 - Object Oriented Programming: Test One Duration - 60 minutes Study the following class and answer the questions that follow: package shapes3d; public class Circular3DShape { private double radius;

More information

Introduction to Computer Science Unit 2. Notes

Introduction to Computer Science Unit 2. Notes Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and

More information

Part (II): In the body method main : Write the call to method formatname and have the return value stored in the variable formatted.

Part (II): In the body method main : Write the call to method formatname and have the return value stored in the variable formatted. CPSC 233 Midterm Review: Winter 2013 Written questions: Question 1 Refer to the code in class MyFormatter and class Driver public class MyFormatter { private String first; private String last; private

More information

Page 1 / 3. Page 2 / 18. Page 3 / 8. Page 4 / 21. Page 5 / 15. Page 6 / 20. Page 7 / 15. Total / 100. Pledge:

Page 1 / 3. Page 2 / 18. Page 3 / 8. Page 4 / 21. Page 5 / 15. Page 6 / 20. Page 7 / 15. Total / 100. Pledge: This pledged exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points, we recommend that you do not

More information

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to

More information

Accurate study guides, High passing rate! Testhorse provides update free of charge in one year!

Accurate study guides, High passing rate! Testhorse provides update free of charge in one year! Accurate study guides, High passing rate! Testhorse provides update free of charge in one year! http://www.testhorse.com Exam : 1Z0-850 Title : Java Standard Edition 5 and 6, Certified Associate Exam Version

More information

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 Name: E-mail Address: TA: Section: You have 80 minutes to complete this exam. For coding questions, you do not need to

More information

1.1 Your First Program

1.1 Your First Program 1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 5/20/2013 9:37:22 AM Why Programming? Why programming? Need

More information

Oracle 1Z Java SE 8 Programmer I. Download Full Version :

Oracle 1Z Java SE 8 Programmer I. Download Full Version : Oracle 1Z0-808 Java SE 8 Programmer I Download Full Version : https://killexams.com/pass4sure/exam-detail/1z0-808 QUESTION: 121 And the commands: Javac Jump.java Java Jump crazy elephant is always What

More information

Unit 10: Sorting/Searching/Recursion

Unit 10: Sorting/Searching/Recursion Unit 10: Sorting/Searching/Recursion Exercises 1. If you search for the value 30 using a linear search, which indices of the 2. If you search for the value -18 using a binary search, which indices of the

More information

Esc101 Mid Semester Exam - II

Esc101 Mid Semester Exam - II Esc101 Mid Semester Exam - II Time Allowed: 1 Hour Max Marks: 75 Instructions: 1. Do not turn this page until the bell rings. 2. YOU MUST WRITE YOUR NAME, ROLL NUMBER & SECTION ON EACH SHEET. 3. Please

More information

AP CS Unit 3: Control Structures Notes

AP CS Unit 3: Control Structures Notes AP CS Unit 3: Control Structures Notes The if and if-else Statements. These statements are called control statements because they control whether a particular block of code is executed or not. Some texts

More information

Exercise 12 Initialization December 16, 2016

Exercise 12 Initialization December 16, 2016 Concepts of Object-Oriented Programming AS 2016 Exercise 12 Initialization December 16, 2016 Task 1 Consider a Java class Vector, representing a 2 dimensional vector: public class Vector { public Number!

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 36 April 23, 2014 Overriding and Equality HW 10 has a HARD deadline Announcements You must submit by midnight, April 30 th Demo your project to your

More information

CS180. Exam 1 Review

CS180. Exam 1 Review CS180 Exam 1 Review What is the output to the following code? System.out.println("2 + 2 = " + (2 + 2)); System.out.println("2 + 2 = " + 2 + 2); What is the output to the following code? System.out.println(String.valueOf(15+20));

More information

Chapter 5: Methods. by Tony Gaddis. Starting Out with Java: From Control Structures through Objects. Fourth Edition

Chapter 5: Methods. by Tony Gaddis. Starting Out with Java: From Control Structures through Objects. Fourth Edition Chapter 5: Methods Starting Out with Java: From Control Structures through Objects Fourth Edition by Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All rights reserved. Reading

More information

Some Sample AP Computer Science A Questions - Solutions

Some Sample AP Computer Science A Questions - Solutions Some Sample AP Computer Science A Questions - s Note: These aren't from actual AP tests. I've created these questions based on looking at actual AP tests. Also, in cases where it's not necessary to have

More information

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments CMSC433, Spring 2004 Programming Language Technology and Paradigms Java Review Jeff Foster Feburary 3, 2004 Administrivia Reading: Liskov, ch 4, optional Eckel, ch 8, 9 Project 1 posted Part 2 was revised

More information

Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site

Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site Appendix 5-1: Attachment J.1 Pricing Table -1: IMS Ceiling Loaded Rates at Contractor Site Escalation rate 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 4.6% 0001 AA01 Administrative Assistant Level I $51.00

More information

ICS 4U. Introduction to Programming in Java. Chapter 10 Notes

ICS 4U. Introduction to Programming in Java. Chapter 10 Notes ICS 4U Introduction to Programming in Java Chapter 10 Notes Classes and Inheritance In Java all programs are classes, but not all classes are programs. A standalone application is a class that contains

More information

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between

More information

ENGR 2710U Midterm Exam UOIT SOLUTION SHEET

ENGR 2710U Midterm Exam UOIT SOLUTION SHEET SOLUTION SHEET ENGR 2710U: Object Oriented Programming & Design Midterm Exam October 19, 2012, Duration: 80 Minutes (9 Pages, 14 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Name: Student Number:

More information

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 ); Sample Final Exam 1. Evaluate each of the following expressions and show the result and data type of each: Expression Value Data Type 14 % 5 1 / 2 + 1 / 3 + 1 / 4 4.0 / 2.0 Math.pow(2.0, 3.0) (double)(2

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

CPSC 219 Extra review and solutions

CPSC 219 Extra review and solutions CPSC 219 Extra review and solutions Multiple choice questions: Unless otherwise specified assume that all necessary variable declarations have been made. For Questions 1 6 determine the output of the print()

More information

CIS March 1, 2018

CIS March 1, 2018 CIS 1068 March 1, 2018 Administrative Stuff Assignment 6 Today s office hours rescheduled: 12:30-1:50 or appointment, or drop by Last Time more on JUnit and what should be done in Assignment 6 Random sentinel

More information

DM550 Introduction to Programming part 2. Jan Baumbach.

DM550 Introduction to Programming part 2. Jan Baumbach. DM550 Introduction to Programming part 2 Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net COURSE ORGANIZATION 2 Course Elements Lectures: 10 lectures Find schedule and class rooms in online

More information

%&'('!' &)*+,- '.+*'(#-.&(/+0* (, '+ 5 12/12 * 18 0! :.., ;..,

%&'('!' &)*+,- '.+*'(#-.&(/+0* (, '+ 5 12/12 * 18 0! :.., ;.., 316.4.05:(37+316.3)]:159.922.27 88.5 744!! "#$ $ %&'('!'! &)*+,- '.+*'(#-.&(/+0*- 1231 -(,. '+ 5 12/12 * 18 0!7 2012. :.., ;.., 744 : - : [0 9*7] / :. 3.. ; + ; 1)*- +, *7.00*#(/! -(, %&'('!' &)*+,- -

More information

Introduction to Computer Science Unit 2. Notes

Introduction to Computer Science Unit 2. Notes Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and

More information

1. Class Relationships

1. Class Relationships 1. Class Relationships See also: Class declarations define new reference types and describe how they are implemented. Constructors are similar to methods, but cannot be invoked directly by a method call;

More information

University of Palestine. Mid Exam Total Grade: 100

University of Palestine. Mid Exam Total Grade: 100 First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int

More information

CS 151. Linked Lists, Recursively Implemented. Wednesday, October 3, 12

CS 151. Linked Lists, Recursively Implemented. Wednesday, October 3, 12 CS 151 Linked Lists, Recursively Implemented 1 2 Linked Lists, Revisited Recall that a linked list is a structure that represents a sequence of elements that are stored non-contiguously in memory. We can

More information

1.1 Your First Program

1.1 Your First Program 1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 1/29/11 6:37 AM! Why Programming? Why programming? Need to

More information

Protistor size 14x51 gr 690VAC (IEC) / 700VAC (UL)

Protistor size 14x51 gr 690VAC (IEC) / 700VAC (UL) 690VAC (IEC) / VAC (UL) Protistor size 4x5 gr 690VAC (IEC) / VAC (UL) SEMICONDUCTOR PROTECTION FUSES IEC HIGH-SPEED CYLINDRICAL FUSE-LINKS AC PROTECTION FEATURES & BENEFITS IEC standard 60269-4 compliant

More information

CS110: PROGRAMMING LANGUAGE I

CS110: PROGRAMMING LANGUAGE I CS110: PROGRAMMING LANGUAGE I Computer Science Department Lecture 8: Methods Lecture Contents: 2 Introduction Program modules in java Defining Methods Calling Methods Scope of local variables Passing Parameters

More information

CS18000: Problem Solving and Object-Oriented Programming

CS18000: Problem Solving and Object-Oriented Programming CS18000: Problem Solving and Object-Oriented Programming Recursion 28 March 2011 Prof. Chris Clifton Recursion Idea: break a problem down into small, similar sub-problems Write a method to solve first

More information

AP COMPUTER SCIENCE A

AP COMPUTER SCIENCE A AP COMPUTER SCIENCE A CONTROL FLOW Aug 28 2017 Week 2 http://apcs.cold.rocks 1 More operators! not!= not equals to % remainder! Goes ahead of boolean!= is used just like == % is used just like / http://apcs.cold.rocks

More information

CIS October 19, 2017

CIS October 19, 2017 CIS 1068 October 19, 2017 Administrative Stuff String methods due tomorrow Boston Accent Reading: up to chapter 5 Midterms Last Time midterm discussion guessing game Legal Identifiers Ch33zyHaX0R cous

More information

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade; Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The

More information

22ND CENTURY_J1.xls Government Site Hourly Rate

22ND CENTURY_J1.xls Government Site Hourly Rate Escalation rate 000 AA0 Administrative Assistant Level I 000 AA0 Administrative Assistant Level II 000 AB0 Application Engineer Level I 000 AB0 Application Engineer Level II 000 AC0 Application Programmer

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 28 March 30, 2018 Overriding Methods, Equality, Enums, Iterators Chapters 25 and 26 Method Overriding When a subclass replaces an inherited method

More information

PASS4TEST IT 인증시험덤프전문사이트

PASS4TEST IT 인증시험덤프전문사이트 PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from

More information

Final Exam CS 152, Computer Programming Fundamentals December 5, 2014

Final Exam CS 152, Computer Programming Fundamentals December 5, 2014 Final Exam CS 152, Computer Programming Fundamentals December 5, 2014 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

More information

CHICAGO. FEBRUARY to thorn, and all drawing nearer to tho tho first yoar. ourd mon to and pokor, and hazard thol munity.

CHICAGO. FEBRUARY to thorn, and all drawing nearer to tho tho first yoar. ourd mon to and pokor, and hazard thol munity. P, \) )\) JC: )(}, 3 \) ) P V 7 v CCG FRRY 8 893 ~ _ ----- ----- 6Q '' y yy " v, y C R G q -, y v c vy c, y k, z y" y C Cy, < y, cy * " " - ), y k v c ck, c k v - v! cc y:, J, z v c v vv, c, "v- yc y ","

More information

// initialize array to true. for (i = 0; i < s; i++) f[i] = true; // get rid of known non-primes f[0] = f[1] = false;

// initialize array to true. for (i = 0; i < s; i++) f[i] = true; // get rid of known non-primes f[0] = f[1] = false; Listing 1: GeneratePrimes.java This class Generates prime numbers up to a user specified maximum. The algorithm used is the Sieve of Eratosthenes. Eratosthenes of Cyrene, b. c. 276 BC, Cyrene, Libya

More information

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff();

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff(); COSC 117 Exam 3 Key Fall 2012 Part 1: Definitions & Short Answer (3 Points Each) 1. A method in a class that has no return type and the same name as the class is called what? How is this type of method

More information

1. Data types ( =13 points)

1. Data types ( =13 points) Software Development I Univ.-Prof. Dr. Alois Ferscha Examination, January 27, 2015 Last name: SAMPLE SOLUTION First name: Institute for Pervasive Computing Lecture hall: Seat: ID: SKZ: Points / Grade:

More information

Expressions & Flow Control

Expressions & Flow Control Objectives Distinguish between instance and local variables 4 Expressions & Flow Control Describe how instance variables are initialized Identify and correct a Possible reference before assignment compiler

More information

Announcements) Programming)Languages)) and)techniques) (CIS120)) FirstWclass)funcTons)via)inner)classes) Anonymous)Inner)Classes) Lecture)26)

Announcements) Programming)Languages)) and)techniques) (CIS120)) FirstWclass)funcTons)via)inner)classes) Anonymous)Inner)Classes) Lecture)26) Programming)Languages)) and)techniques) (CIS120)) Lecture)26) March)28,)2014) )Extension) Announcements) HW08)(GUI)Programming)II))is)due)next)Tuesday)at) 11:59:59pm) Midterm(2(is(Friday,((April(4 th (in(class(

More information

The class Object. Lecture CS1122 Summer 2008

The class Object.  Lecture CS1122 Summer 2008 The class Object http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object.html Lecture 10 -- CS1122 Summer 2008 Review Object is at the top of every hierarchy. Every class in Java has an IS-A relationship

More information

Exercise 12 Initialization December 15, 2017

Exercise 12 Initialization December 15, 2017 Concepts of Object-Oriented Programming AS 2017 Exercise 12 Initialization December 15, 2017 Task 1 Consider a Java class Vector, representing a 2 dimensional vector: public class Vector { public Number!

More information

M e t h o d s a n d P a r a m e t e r s

M e t h o d s a n d P a r a m e t e r s M e t h o d s a n d P a r a m e t e r s Objective #1: Call methods. Methods are reusable sections of code that perform actions. Many methods come from classes that are built into the Java language. For

More information

I. True/False: (2 points each)

I. True/False: (2 points each) CS 102 - Introduction to Programming Midterm Exam #2 - Prof. Reed Spring 2008 What is your name?: (2 points) There are three sections: I. True/False..............54 points; (27 questions, 2 points each)

More information

Solutions Manual. Data Structures and Algorithms in Java, 5th edition International Student Version. M. T. Goodrich and R.

Solutions Manual. Data Structures and Algorithms in Java, 5th edition International Student Version. M. T. Goodrich and R. Solutions Manual Data Structures and Algorithms in Java, 5th edition International Student Version M. T. Goodrich and R. Tamassia Chapter 1 Reinforcement Solution R-1.1 Since, after the clone, A[4] and

More information

Introduction to Java. March 1, 2001 CBRSS and the John M. Olin Institute for Strategic Studies Lars-Erik Cederman

Introduction to Java. March 1, 2001 CBRSS and the John M. Olin Institute for Strategic Studies Lars-Erik Cederman Introduction to Java March 1, 2001 CBRSS and the John M. Olin Institute for Strategic Studies Lars-Erik Cederman Outline Java overview simple structures object-orientation roulette example How to compile

More information

Problem 7.4: Racetrack

Problem 7.4: Racetrack ENCE 688R: Solutions to Homework 1 March 2016 Problem 7.3: Find smallest number that is evenly divisible by all of the numbers 1 through 20. Source code: / =====================================================================

More information

CS170 Introduction to Computer Science Midterm 2

CS170 Introduction to Computer Science Midterm 2 CS170 Introduction to Computer Science Midterm 2 03/25/2009 Name: Solution You are to honor the Emory Honor Code. This is a closed book and closednotes exam, and you are not to use any other resource than

More information

ESC101 : Fundamental of Computing

ESC101 : Fundamental of Computing ESC101 : Fundamental of Computing End Semester Exam 19 November 2008 Name : Roll No. : Section : Note : Read the instructions carefully 1. You will lose 3 marks if you forget to write your name, roll number,

More information

CSE 331 Winter 2016 Midterm Solution

CSE 331 Winter 2016 Midterm Solution CSE 331 Winter 2016 Midterm Solution Name There are 7 questions worth a total of 100 points. Please budget your time so that you get to all of the questions. Keep your answers concise. The exam is closed

More information

Loops. CSE 114, Computer Science 1 Stony Brook University

Loops. CSE 114, Computer Science 1 Stony Brook University Loops CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation Suppose that you need to print a string (e.g., "Welcome to Java!") a user-defined times N: N?

More information

CS18000: Programming I

CS18000: Programming I CS18000: Programming I Linked Data Structures 5 April 2010 Prof. Chris Clifton Multiple Items: Beyond Arrays interface Set { boolean contains(e item); /* true iff x s.t. item.equals(x) */ void add(e

More information

Comments on Mohr and Henderson's Path Consistency

Comments on Mohr and Henderson's Path Consistency Purdue University Purdue e-pubs Computer Science Technical Reports Department of Computer Science 1988 Comments on Mohr and Henderson's Path Consistency Ching-Chih Han Chia-Hoang Lee Report Number: 88-733

More information

The effect of investment in the Industrial Estates in Palestine on the job creation opportunities

The effect of investment in the Industrial Estates in Palestine on the job creation opportunities (! " : ) The effect of investment in the Industrial Estates in Palestine on the job creation opportunities (case study: The industrial estates and the industrial free zones under the control of Palestinian

More information

Exercise 12 Initialization December 14, 2018

Exercise 12 Initialization December 14, 2018 Concepts of Object-Oriented Programming AS 2018 Exercise 12 Initialization December 14, 2018 Task 1 Consider a class Vector, representing a 2 dimensional vector, written in a Java-like language with non-null

More information

Introduction to Computer Science Unit 2. Exercises

Introduction to Computer Science Unit 2. Exercises Introduction to Computer Science Unit 2. Exercises Note: Curly brackets { are optional if there is only one statement associated with the if (or ) statement. 1. If the user enters 82, what is 2. If the

More information

Numbers Implicit This Static Methods and Fields Packages Access Modifiers Main Overloading Exceptions Etc.

Numbers Implicit This Static Methods and Fields Packages Access Modifiers Main Overloading Exceptions Etc. Numbers Implicit This Static Methods and Fields Packages Access Modifiers Main Overloading Exceptions Etc. 1 Integers Java s number system: byte an integer between -128 and 127 short an integer between

More information

static String usersname; public static int numberofplayers; private static double velocity, time;

static String usersname; public static int numberofplayers; private static double velocity, time; A class can include other things besides subroutines. In particular, it can also include variable declarations. Of course, you can declare variables inside subroutines. Those are called local variables.

More information