Public class Hello { /** * My first Java program */ public static void main( string[ ] args) { // prints the string Hello world on screen

Size: px
Start display at page:

Download "Public class Hello { /** * My first Java program */ public static void main( string[ ] args) { // prints the string Hello world on screen"

Transcription

1 !"# *$% & ' &() 5++.,-./0%$%1+2'31+4&031"+' *6 *%89:1+,+ ()!8;4< 0$& 7' Public class Hello { /** * My first Java program */ public static void main( string[ ] args) { // prints the string Hello world on screen System.out.println("Hello world"); } } &!+4= *@$Hello>?8!

2 E#C" C%BD*AB>?8 8." C O0%PG%'>?8C+L-81K+L#D*%' C 0N'$ *Q+R+S/?: C &0T"8!++B5+K+L# *@$ U- 7CVP&0%"&B M0'I8P Q0P&M&' I8P!+4! Public class Hello { Q+ -;M".&W'"PQ+'8%X Public class Hello { %'& T+SB&B M$ Public class Hello { /** * My first Java program */ T+S *+F0N'$ 8C) &C$%'& 8@$&5+X

3 *8 &C$%'Y%.ZT &8C) Public class Hello { /** * My first Java program */ public static void main( string[ ] args) { *+%80N'$ * main'%@$hello>?8'7"abb *%' 3&<main&' *CVPmain'7 applet&%\'$. *+%8^;]+: 0'&88!J.< "& R+S75+&B M_ // prints the string Hello world on screen %+/!+8!+ 0'!'System.out.println()'$_ *%8`X *%$. Hello>?8main'a+ #I8P_

4 8&; *%$..java# +..& *b >?8F^\"%/ * ']+;<public>?8 *c +%80+d- "P.1@$0@$Hello.public *Hello.java8!+B'7[)>?878+%8[)T+S&-+$ *e *&8X &8T+S *+F0N'$0'&8&C$%'Y% *b &+g.zt!'5! % fr+s&;%m *c * & T+S3 C++T+S7;$". *b CT+S7;$ *c %$h)7;$ *e C++T+S7;$

5 M"#.!CB 00P!'.j!8iiC0N'$ - T+S"%/ // This is a C++ comment style or a single line comment CT+S7;$ L! +;B5+<%XT+S"%/ T+S3!C T+S!'+-./*/ 03/* 8+F0N'$ /* this is an example of a C style or multiline comment */. T+S& h)7;$ ]:C& &C$%'Y% T+Sh)7;$C *' F0W html 7 "P./** T+S3 (javadoc)7;$!c" 0W & % 5+&,&"@?/&%T+S!!+%k. *8 +%, "'T+S&'+ /?:+' "P&-+$ /** This is an example of special java doc comments used for \n generating an html documentation. It uses tags Florence 1.2 */

6 ^\"%/ *$. ;"4L+.$7 CM System.out.println("Hello world"); U-. I8P!+%k.03I8P 8;/7C(+ 7 *%8&% 0F9() 7"%/ ;/$ *0 8 %'+;/ *@$CU-!+ (white space) 4&l B ^\"%/ U- public static void main( String[ ] args ){ System.out.println("Hello"); System.out.println("world ); } &8;/U- 8&<.% 8+ <".&W'^I8P8+'').U- public static void main( String[ ] args ){ ;/"P public static void main( String[ ] args ) + &B M&'

7 { 1+U- 7"+8;/& ' G%8&7.8 8!D+%8,' public static void main( String[ ] args ) { System.out.println("Hello"); System.out.println("world"); } &$% B***>?81'1+2'&8%'""%/ *%%8 $%C^\Hello, main, System, outm &?\ *%' " C8@$%B"!f%'Case-sensitive&$% *%'+"LhelloHello&$% MC0nC@?/1;N49CL %M $% 7X8%;N49*3 $ I.underline ( _ ) *80N'$5+NH/C"$%7&*% o5 \*% &+-8.-8C%.&$% class, public,void *Q+R+S'+ 0%P& O &8+2' 8.% ^\"%/ f+%8z)'o5 9C^9>?8&&

8 ThisIsAnExampleOfClassName +2''&& 4 ^\"%/ f+%8z)' thisisanexampleofvariablename thisisanexampleofmethodname "8+#& G0+L%XC8D) %X&+2' 9C&B +%8Z)'o5 chararray, filenumber, classname +%85+#+2'3& 0nC.Z)'C _write _read & CH +'$Y% M$8%'+2' *0!++B(+# 1>?81'"%/ &+-8.-8C+.. *+%80N'$" &+2' &+-824C'+4C

9 Integer Floating-point Boolean Character string R+TH/ %5+.&// <% '88 ' integerr+th 8 FF&a4R+TH/ 0/ o 05&%;/ o ". R+TH/C0N'$QWL

10 0/&,& S.p+" 8, 8 0+# 07, 0457% 05&%;/& 8 0X0x+# 0xc, 0Xb, 0x4a3% Floating-pointG&/D%5+./ *% &/() / 0 8.-/.H '$H 8@+-! Standard: Scientific: e-4, e2 True: False: G'$jCD@$ G '$jcd@$ Boolean<% % '%'+M <% Characters&'88

11 *+F 5H '$'887M Unicode&'88 *L$'+ r&'88/.!5,8'+ bq&'88/._."' 80C!(Unicode)".'88'$_ *80N'$&," C&'88G.Dh)&'88 +6.T(')".single quote!+ "P'88C0N'$& _ *+6.0N'$'a'H a'88c^\"%/ (-$7 '88newlineM'88%h)&'88_ 0"&'88&8&-+$ 1backslash newlinem& '/n''88^\"%/ carriagereturnm& '\r''88 backspace"."f '88& '\b''88 string&' "P 8,% 0 8 '88CFL &' *8Tdouble quotes!+8!+ "P Q'C4\"%/ "Hello world!!!" "this is an example to represent string values" +4&03

12 (+#: " C Boolean (for logical values) Character (for textual) Byte Short Integer Long (integer) double float (floating point) True, False G<%& D!+4 G%'& 8& 08 R+TH GR+THDo5 G&//D% GBooleanD<%&03 6@49 Boolean&03 ^\"%/ Boolean result = True; &+40ABresult Boolean3C&+2'm ^\ *@$00"P True char&'88&03 * BUnicode&'88C'887M$&'88&03 'singlequote!+ TH 03! *

13 ^\"%/ 'a' //The letter a ' \t ' // a TAB doublequotessinglequote\fh)&'88(.& ' \' ' \\ single quote ' \" ' \\ double quotes +%80N'$\'88C H D.'%+47"%/ string8%x *Q+%8N'8"P$ M ()!1G%'>?8 '*% '88!%X8%%860f' *=<>?8"%/ 0;+4&03"%/ 'double quotes!+ TH ' String message = " Hello world! "; String' *% ^\"%/ R+TH& +4&03 D'@10 8 L$ R+TH 2 \\ decimal value 077 \\ an octal value G05&%;D505G@&%;

14 0x45b1a \\ a hex value *@%& int&03s (+#: 1R+TH3 + Long&03H "PLl9" l 10L +%80C^+R+TH&03& &0C byte short int qv ^BH _c t c t _b _c bu c bu _b _c eb c eb _b _c qe c qe _b

15 03C0N'$&.% 8X*.+HL7X89C0N'$longAB,% 1&/ "PN[+)"PC0N'$H %5+.& +4& "%/ double1s (+#: &/3 *+F % CCL5+/%'+&/ e or E \\. &0H? f or F d or D \\ float \\ double ^\ 3.14 //A simple floating-point value (a double) 6.02E23 //o5 &/ F // A simple float size value 123.4E+306D // *@$0H9 D "5 8o5 7 w#c&0c &/&03 *Q+%85+#"P^B@;gC@$0$^%8PC

16 *0N'$7"80+d& +2' +2'8&3"P&-+$ 8*03_ *?/1%80+d %%8&+#&wF!+C +2'*Q$"& _ *'% +2' "P +4Z'+2'"?/ +%8?/CH +2' <data type> <name> [=initial value]; &+'[ ]!+ 'T4 x+'9<>!+ 'T $ "PT+SQP%&0$& 'W U& 1. public class variablesamples { 2. public static void main (string [ ] Args) { 3. // declare a data type with variable name 4. // result and Boolean data type 5. Boolean result; // declare a data type with variable name 8. // option and char data type 9. char option; * Q+%8

17 10. option='c'; // assign c to option 11. // declare a data type with variable name 12. // grade, double data type and initialized 13. // to double grade=0.0; 15. } 16. } "P "+4+2'8&.% +4"P 1+%8AB+2'8!yT +.@$'W *+ [+) &0%%8A+H8Q$%BD*+%8Z)'N+H$+2'& (."P8+ '&+2'+F^\"%/ G% "P & "C 7L%f+% grade"p1+%80+d"cp *+%8Z)'"P +%8AB+2'7 CM double exam=0; double quiz=12; double m L +2'"?/ double exam=0, double quiz=12, double grade=18; "%/ +2' Q+%80N'$C&" CQ+[)+2'7`XY% System.out.println( ); System.out.print( );

18 +%8"%/ +2'!'& &."%/ C& 1 public class OutputVariable { 2 public static void main( String[] args ){ 3 int value = 10; 4 char x; 5 x = A ; 6 7 System.out.println( value ); 8 System.out.println( The value of x= + x ); 9 } 10 } (."%/ C!'! 10 The value of x=a System.out.print( )System.out.println( )'$& M710!++B&0`XCB System.out.println( )'$ *%8C W'. S&,5+Xp+0`XCB System.out.print( )'$ *%8 +%8"P&0.! 'W U& Example 1: System.out.print("Hello "); System.out.print("world!"); *****************************************************

19 Out put is: Hello world! Example 2: System.out.println("Hello "); Syetem.out.println("world!"); ******************************************************* Out put is: Hello World! +4&+2'3&+2' +2'3 +4&+2'_ 3&+2'_ +4&+2' longint%+4 +2'_ *%%80+dY 901+9H _ 3&+2' *%%80+dY 9&l >P8%'+2'_ -H&08%B1%%80Y 9C&,"L _ * +2'7.O1+%8"?/[)>?87C&+2''_ %BD*@$0' F>?8".C8+%8 BJ+3C3 )7!' \ 8+%8@$E7+2'"P&-+$

20 G >?8C. Qstringint&03 +2'+%8s ^\"%/ int num=10; // primitive type string name="hello"; // reference type ^-$&>P.L+6*".&Y *,80!+%k.1Y 9&,-./A-')3 ;$T&,-./_ &< &,-./_ <%&,-./_ :&,-./_!%X ;+X 8 1%88,-./,-./

21 ;$T&,-./ %88;$T&,-./ 8 7C4\_ 1 public class ArithmeticDemo { 2 public static void main(string[] args){ 3 //a few numbers 4 int i = 37; 5 int j = 42; 6 double x = ; 7 double y = 7.22; 8 System.out.println("Variable values..."); 9 System.out.println(" i = " + i); 10 System.out.println(" j = " + j); 11 System.out.println(" x = " + x); 12 System.out.println(" y = " + y); System.out.println("Adding..."); 13 System.out.println(" i + j = " + (i + j));

22 14 System.out.println(" x + y = " + (x + y)); 15 //subtracting numbers 16 System.out.println("Subtracting..."); 17 System.out.println(" i - j = " + (i j)); 18 System.out.println(" x - y = " + (x y)); //multiplying numbers 21 System.out.println("Multiplying..."); 22 System.out.println(" i * j = " + (i * j)); 23 System.out.println(" x * y = " + (x * y)); //dividing numbers 26 System.out.println("Dividing..."); 27 System.out.println(" i / j = " + (i / j)); 28 System.out.println(" x / y = " + (x / y)); 29 //computing the remainder resulting from dividing 30 // numbers 31 System.out.println("Computing the remainder..."); 32 System.out.println(" i % j = " + (i % j)); 33 System.out.println(" x % y = " + (x % y)); //mixing types 36 System.out.println("Mixing types..."); 37 System.out.println(" j + y = " + (j + y)); 38 System.out.println(" i * x = " + (i * x)); 39 } 40 } ********************************************************************* & Variable values... i = 37

23 j = 42 x = y = 7.22 Adding... i + j = 79 x + y = Subtracting... i - j = -5 x - y = Multiplying... i * j = 1554 x * y = Dividing... i / j = 0 x / y = Computing the remainder... i % j = 37 x % y = Mixing types... j + y = i * x = ,-./7&-./"%/ &//7R+TH/78''L 8!C(+#O!* &//7+'1' F8

24 &//7 ;%.S: &//1 ;$T./ *0+g;$T{z$ 85 &,-./ G D,5,-./ G D,8,-./ (5 97a+,-./85 &,-./ *%(8 ^BC&;/^\"%/ count = count + 1 ; count ++ ; 85,&,-./L-./ } ^

25 *0P"-./CB ;%85 &,-./ (8i(5 97-./' 1' F8 -./C;F *0+g;$T+2'{z$ int i = 10; int j = 3; int k = 0; k = ++j + i; // will result to k = 4+10 = 14 ;$T-./&+4' 1' F8 -./CB F (8i(5 97+2'"PCB 0ga+ int i = 10; int j = 3; int k = 0; k = j++ + i; // will result to k = 3+10 = 13 ^\"%/ * ^\"%/ 8_5 &,-./C0N'$&'L 0$8+, 8 &F 8_5 &,-./;/+.~ *% QW '9 0 &< &,-./ "P"+&< 080&< &,-./ *%%8"+

26 %BooleanCLH C! (True/False)* %P'+,-./!L-./&0T d^]:c +%8C^\ 8U& 1 public class RelationalDemo{ 2 public static void main(string[] args){ 3 //a few numbers 4 int i = 37; 5 int j = 42; 6 int k = 42; 7 System.out.println("Variable values..."); 8 System.out.println(" i = " +i); 9 System.out.println(" j = " +j); 10 System.out.println(" k = " +k); 11 //greater than

27 12 System.out.println("Greater than..."); 13 System.out.println(" i > j = "+(i>j));//false 14 System.out.println(" j > i = "+(j>i));//true 15 System.out.println(" k > j = "+(k>j));//false 16 //greater than or equal to 17 System.out.println("Greater than or equal to..."); 18 System.out.println(" i >= j = "+(i>=j));//false 19 System.out.println(" j >= i = "+(j>=i));//true 20 System.out.println(" k >= j = "+(k>=j));//true 21 //less than 22 System.out.println("Less than..."); 23 System.out.println(" i < j = "+(i<j));//true 24 System.out.println(" j < i = "+(j<i));//false 25 System.out.println(" k < j = "+(k<j));//false 26 //less than or equal to 27 System.out.println("Less than or equal to..."); 28 System.out.println(" i <= j = "+(i<=j));//true 29 System.out.println(" j <= i = "+(j<=i));//false 30 System.out.println(" k <= j = "+(k<=j));//true 31 //equal to 32 System.out.println("Equal to..."); 33 System.out.println(" i == j = " + (i==j));//false 34 System.out.println(" k == j = " + (k==j));//true 35 //not equal to 36 System.out.println("Not equal to..."); 37 System.out.println(" i!= j = " + (i!=j));//true 38 System.out.println(" k!= j = " + (k!=j));//false 39 } 40 } Q!&

28 Variable values... i = 37 j = 42 k = 42 Greater than... i > j = false j > i = true k > j = false Greater than or equal to... i >= j = false j >= i = true k >= j = true Less than... i < j = true j < i = false k < j = false Less than or equal to... i <= j = true j <= i = false k <= j = true Equal to... i == j = false k == j = true Not equal to... i!= j = true k!= j = false

29 <%&,-./ 8&-./"%/ Boolean7<%&,-./ *%F Boolean7"%/ +' <%,-./3( &<% 4 ]<% <%& 4 ]<%& ^&T&!y+ 0 8 CH <%&,-./-8: X1 op X2 Boolean;/"00"X2X1 8 &F(&.CL5+op.*@ gx% +2'X^9 *b *c *e *v *u *q * 8w4m.&0%"H?: f0"b 8'$&^ *% X2X1a+8C!L.I9 &&&& '$^

30 &&&"+-HN C]: && C00;/^\"%/ B$1 ''$jcf%8 Cexp11&&,-./ exp1f8xgexp2 " D*,+ exp2cy% H8H91 ''$ * C-./1+'"F C;+.&,-./1 _ *%8 &&&&,-./L-./&0TC4\ 1 public class TestAND { 2 public static void main( String[ ] args ){ 3 int i = 0; 4 int j = 10; 5 boolean test= false;

31 6 // demonstrate && 7 test = (i > 10) && (j++ > 9); 8 System.out.println(i); 9 System.out.println(j); 10 System.out.println(test); 11 // demonstrate & 12 test = (i > 10) & (j++ > 9); 13 System.out.println(i); 14 System.out.println(j); 15 System.out.println(test); 16 } 17 } dh 8B<! "X*. C1&&-./8<j++;/8+%8_ *@$0 CFalse"PC(+#i>10^;/ &,-./& '$^

32 &,-./!+ -HN,-./L+49f%80N'$O$ C&0+C,-./ Q+, YCH Y;/F exp1 exp2 B$1 + True"PL+H%8 Cexp1',-./ *F True;/fexp2 C" exp2exp1;/' 1+'"F C(+#f,-./ *%8 C1 +%81@$00d8& B< 1'W U& 1 public class TestOR { 2 public static void main( String[] args ){ 3 int i = 0; 4 int j = 10; 5 boolean test= false; 6 //demonstrate 7 test = (i < 10) (j++ > 9); 8 System.out.println(i); 9 System.out.println(j);

33 10 System.out.println(test); 11 //demonstrate 12 test = (i < 10) (j++ > 9); 13 System.out.println(i); 14 System.out.println(j); 15 System.out.println(test); 16 } 17 8! "X*. Cf@$,-./&8<j++;/8+%8_ *@$0 '$^@.!

34 C&+' * CGFalseD@$&,GTrueD@$-./C C(+#-./^&T&,-./L-./8+%8 *+F C+'"F +%88B<! 'W U& 1 public class TestXOR { 2 public static void main( String[ ] args ){ 3 boolean val1 = true; 4 boolean val2 = true; 5 System.out.println(val1 ^ val2); 6 val1 = false; val2 = true; 7 System.out.println(val1 ^ val2); 8 val1 = false; val2 = false; 9 System.out.println(val1 ^ val2); 10 val1 = true; val2 = false; 11 System.out.println(val1 ^ val2); 12 } 13 } dl 8!!y+,-./L-./

35 ;/7"FP"P8&: *%88"FP7!,-./ g+2' Q0P,-./!& '$^d 'W U& 8B<7QC _ 1 public class TestNOT { 2 public static void main( String[] args ){ 3 boolean val1 = true; 4 boolean val2 = false; 5 System.out.println(!val1); 6 System.out.println(!val2); 7 } 8 } false 88B<!_?::<%,-./ "5.H "FP$8%B! *@$F$,-./7 _ *w#:&;/"%/

36 @$CH?:,-./&+F8 '$ exp1? exp2 : exp3 True@$!L."P&+'8@$Boolean;/7exp1% * False?:,-./&+' 0F +'"%/ exp2;/1 ''$jcexp1f * 0F +'"%/ exp3 ;/1 ''$jcexp1f * Q+%8=:^\"%/ &8B<'W U& 1 public class ConditionalOperator { 2 public static void main( String[] args ){ 3 String status = ""; 4 int grade = 80; 5 //get status of the student 6 status = (grade >= 60)?"Passed":"Fail"; 7 //print status 8 System.out.println( status ); 9 } 10 } 8B<!&+'@W_ Q%P'W?:,-./M$+'"FC &0T CL _

37 &+#H!+C,-./ C1 ;/3 1.. [ ] ( ) ! ~ 3. * / % << >> >>> <<< 6. < > <= >=

38 7. ==!= 8. & 9. ^ 10. && ?: 13. = m ^'L_ * L@4C1^C<$78;/Gb ;/Gc * QC#C&0+k+#;/$ I 0'NFa4< 8C CH ";/! ;/&@4&'L ;/f;$t&,-./ C.F$FC5+#& *+%80N'$5'#C089:0$H

39 4!0"+ a4<&h? G%' & F$%1U- 1;/ G'&'881G!+4 D<%1%5+.1R+THD string, character, boolean, floating point, integer a+ boolean, char, byte, short, int, long, float, +4&03 double G"%/ `X1+41"?/D+2' System.out.print( )System.out.println( )& +43 < &,-./15 _8&,-./1;$T&,-./D,-./ ~~~~~~ >.+. *CTfo? jcp%p "'W

4 Programming Fundamentals. Introduction to Programming 1 1

4 Programming Fundamentals. Introduction to Programming 1 1 4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,

More information

Getting started with Java

Getting started with Java Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving

More information

1. Download the JDK 6, from

1. Download the JDK 6, from 1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the

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

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

DATA TYPES AND EXPRESSIONS

DATA TYPES AND EXPRESSIONS DATA TYPES AND EXPRESSIONS Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment Mathematical

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

Java Basic Datatypees

Java Basic Datatypees Basic Datatypees Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory. Based on the data type of a variable,

More information

Tools : The Java Compiler. The Java Interpreter. The Java Debugger

Tools : The Java Compiler. The Java Interpreter. The Java Debugger Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

JAVA Programming Fundamentals

JAVA Programming Fundamentals Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

More information

Basic Operations jgrasp debugger Writing Programs & Checkstyle

Basic Operations jgrasp debugger Writing Programs & Checkstyle Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent

More information

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

CSE 201 JAVA PROGRAMMING I. Copyright 2016 by Smart Coding School

CSE 201 JAVA PROGRAMMING I. Copyright 2016 by Smart Coding School CSE 201 JAVA PROGRAMMING I Primitive Data Type Primitive Data Type 8-bit signed Two s complement Integer -128 ~ 127 Primitive Data Type 16-bit signed Two s complement Integer -32768 ~ 32767 Primitive Data

More information

Java Programming for Selenium

Java Programming for Selenium Video 5 - Java Control Flow, String Handling and Arrays Java Programming for Selenium 1) Conditional / Decision Making 2) Loop 3) Branching 4) String Handling in Java 5) Java Arrays 1) Conditional / Decision

More information

Basics of Java Programming

Basics of Java Programming Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement

More information

CMSC131. Introduction to your Introduction to Java. Why Java?

CMSC131. Introduction to your Introduction to Java. Why Java? CMSC131 Introduction to your Introduction to Java Why Java? It s a popular language in both industry and introductory programming courses. It makes use of programming structures and techniques that can

More information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can

More information

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014 Exercises Software Development I 03 Data Representation Data types, range of values, ernal format, literals October 22nd, 2014 Software Development I Wer term 2013/2014 Priv.-Doz. Dipl.-Ing. Dr. Andreas

More information

CS Week 5. Jim Williams, PhD

CS Week 5. Jim Williams, PhD CS 200 - Week 5 Jim Williams, PhD The Study Cycle Check Am I using study methods that are effective? Do I understand the material enough to teach it to others? http://students.lsu.edu/academicsuccess/studying/strategies/tests/studying

More information

Program Fundamentals

Program Fundamentals Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 YEAR: 10 Computing Time: 1½ Hr. Name: Class: Instructions: 1. Answer all the questions in the space provided on this paper. 2. Calculators

More information

Java Programming Language Mr.Rungrote Phonkam

Java Programming Language Mr.Rungrote Phonkam 3 Java Programming Language Mr.Rungrote Phonkam rungrote@it.kmitl.ac.th Contents 1. Identify 2. Method Member 3. Literals 4. Data Type 6. Variable 1. Identify ก ก Class, Data, Method, Variable, Label,

More information

Chapter 1 Preliminaries

Chapter 1 Preliminaries Chapter 1 Preliminaries This chapter discusses the major classes of programming languages and the relationship among them. It also discusses the binary and the hexadecimal number systems which are used

More information

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks: كلية الحاسبات وتقنية المعلوما Exam 2 Programming I (CPCS 202) Instructor: M. G. Abbas Malik Date: November 22, 2015 Student Name: Student ID: Total Marks: 40 Obtained Marks: Instructions: Do not open this

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process Entry Point of Execution: the main Method Elementary Programming EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG For now, all your programming exercises will

More information

Object-Oriented Programming. Topic 2: Fundamental Programming Structures in Java

Object-Oriented Programming. Topic 2: Fundamental Programming Structures in Java Electrical and Computer Engineering Object-Oriented Topic 2: Fundamental Structures in Java Maj Joel Young Joel.Young@afit.edu 8-Sep-03 Maj Joel Young Java Identifiers Identifiers Used to name local variables

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

TUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN. Week 12/02/ /02/2007 Lecture Notes:

TUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN. Week 12/02/ /02/2007 Lecture Notes: 1 INSTRUCTOR: FAZLI CAN TUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN Week 12/02/2007-16/02/2007 Lecture Notes: When we write a program we must design our programs to take correct output. For correct output,

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data

More information

Java Programming Language. 0 A history

Java Programming Language. 0 A history Java Programming Language 0 A history How java works What you ll do in Java JVM API Java Features 0Platform Independence. 0Object Oriented. 0Compiler/Interpreter 0 Good Performance 0Robust. 0Security 0

More information

Java Identifiers, Data Types & Variables

Java Identifiers, Data Types & Variables Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.

More information

Java Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2

Java Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2 Java Foundations Introduction to Program Design and Data Structures 4th Edition Lewis TEST BANK Full download at : https://testbankreal.com/download/java-foundations-introduction-toprogram-design-and-data-structures-4th-edition-lewis-test-bank/

More information

Java Classes & Primitive Types

Java Classes & Primitive Types Java Classes & Primitive Types Rui Moreira Classes Ponto (from figgeom) x : int = 0 y : int = 0 n Attributes q Characteristics/properties of classes q Primitive types (e.g., char, byte, int, float, etc.)

More information

Chapter 2: Using Data

Chapter 2: Using Data Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that

More information

Java Classes & Primitive Types

Java Classes & Primitive Types Java Classes & Primitive Types Rui Moreira Classes Ponto (from figgeom) x : int = 0 y : int = 0 n Attributes q Characteristics/properties of classes q Primitive types (e.g., char, byte, int, float, etc.)

More information

Prof. Navrati Saxena TA: Rochak Sachan

Prof. Navrati Saxena TA: Rochak Sachan JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 2 Data types type: A category or set of data

More information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

A Java program contains at least one class definition.

A Java program contains at least one class definition. Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

More information

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M.

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M. Java Language Essentials Java is Case Sensitive All Keywords are lower case White space characters are ignored Spaces, tabs, new lines Java statements must end with a semicolon ; Compound statements use

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

(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

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 Copyright 2009 by Pearson Education Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 Copyright

More information

( &% class MyClass { }

( &% class MyClass { } Recall! $! "" # ' ' )' %&! ( &% class MyClass { $ Individual things that differentiate one object from another Determine the appearance, state or qualities of objects Represents any variables needed for

More information

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1 topics: introduction to java, part 1 cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 cis20.1-fall2007-sklar-leci.2 1 Java. Java is an object-oriented language: it is

More information

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1 Version 1 1. (24 Points) Show the routing tables for routers A, B, C, and D. Make sure you account for traffic to the Internet. NOTE: Router E should only be used for Internet traffic. Router A Router

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 2: Data and Expressions CS 121 1 / 53 Chapter 2 Part 1: Data Types

More information

Declaration and Memory

Declaration and Memory Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier

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

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1 CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1 This exam is closed book, closed notes. All cell phones must be turned off. No calculators may be used. You have two hours to complete

More information

Primitive Data, Variables, and Expressions; Simple Conditional Execution

Primitive Data, Variables, and Expressions; Simple Conditional Execution Unit 2, Part 1 Primitive Data, Variables, and Expressions; Simple Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Overview of the Programming Process Analysis/Specification

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

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac

More information

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type

More information

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char Review Primitive Data Types & Variables int, long float, double boolean char String Mathematical operators: + - * / % Comparison: < > = == 1 1.3 Conditionals and Loops Introduction to Programming in

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

MODULE 02: BASIC COMPUTATION IN JAVA

MODULE 02: BASIC COMPUTATION IN JAVA MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment

More information

Computer Programming, I. Laboratory Manual. Final Exam Solution

Computer Programming, I. Laboratory Manual. Final Exam Solution Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Final Exam Solution

More information

Decisions in Java IF Statements

Decisions in Java IF Statements Boolean Values & Variables In order to make decisions, Java uses the concept of true and false, which are boolean values. Just as is the case with other primitive data types, we can create boolean variables

More information

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Java Control Statements

Java Control Statements Java Control Statements An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

4. Specifications and Additional Information

4. Specifications and Additional Information 4. Specifications and Additional Information AGX52004-1.0 8B/10B Code This section provides information about the data and control codes for Arria GX devices. Code Notation The 8B/10B data and control

More information

Programming Projects: 2.1, 2.3, 2.4, 2.7, 2.8, 2.13

Programming Projects: 2.1, 2.3, 2.4, 2.7, 2.8, 2.13 Chapter 2 Objects and Primitive Data - AP Chapter Objectives Define the difference between primitive data and objects. Declare and use variables. Perform mathematical computations. Create objects and use

More information

data_type variable_name = value; Here value is optional because in java, you can declare the variable first and then later assign the value to it.

data_type variable_name = value; Here value is optional because in java, you can declare the variable first and then later assign the value to it. Introduction to JAVA JAVA is a programming language which is used in Android App Development. It is class based and object oriented programming whose syntax is influenced by C++. The primary goals of JAVA

More information

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Web Site I have decided to keep this site for the whole semester I still hope to have blackboard up and running, but you

More information

Operators in java Operator operands.

Operators in java Operator operands. Operators in java Operator in java is a symbol that is used to perform operations and the objects of operation are referred as operands. There are many types of operators in java such as unary operator,

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

Array. Lecture 12. Based on Slides of Dr. Norazah Yusof

Array. Lecture 12. Based on Slides of Dr. Norazah Yusof Array Lecture 12 Based on Slides of Dr. Norazah Yusof 1 Introducing Arrays Array is a data structure that represents a collection of the same types of data. In Java, array is an object that can store a

More information

Full file at

Full file at Gaddis: Starting Out with Java: Early Objects, 4/e Test Bank 1 Chapter 2 Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Which of the

More information

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition

More information

CS11 Java. Fall Lecture 1

CS11 Java. Fall Lecture 1 CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon

More information

Oct Decision Structures cont d

Oct Decision Structures cont d Oct. 29 - Decision Structures cont d Programming Style and the if Statement Even though an if statement usually spans more than one line, it is really one statement. For instance, the following if statements

More information

Java Programming Fundamentals. Visit for more.

Java Programming Fundamentals. Visit  for more. Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)

More information

Memory, Data, & Addressing II CSE 351 Spring

Memory, Data, & Addressing II CSE 351 Spring Memory, Data, & Addressing II CSE 351 Spring 2018 http://xkcd.com/138/ Review Questions 1) If the word size of a machine is 64-bits, which of the following is usually true? (pick all that apply) a) 64

More information

Assignment 2.4: Loops

Assignment 2.4: Loops Writing Programs that Use the Terminal 0. Writing to the Terminal Assignment 2.4: Loops In this project, we will be sending our answers to the terminal for the user to see. To write numbers and text to

More information

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program. Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language

More information

Strings, Strings and characters, String class methods. JAVA Standard Edition

Strings, Strings and characters, String class methods. JAVA Standard Edition Strings, Strings and characters, String class methods JAVA Standard Edition Java - Character Class Normally, when we work with characters, we use primitive data types char. char ch = 'a'; // Unicode for

More information

Session 3. Basic Java Data Types, Control Structures. 8 primitive or built-in data types

Session 3. Basic Java Data Types, Control Structures. 8 primitive or built-in data types Session 3 Basic Java Data Types, Control Structures Java Data Types 8 primitive or built-in data types 4 integer types (byte, short, int, long) 2 floating point types (float, double) Boolean (boolean)

More information

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 Announcements Midterm Exams on 4 th of June (12:35 14:35) Room allocation will be announced soon

More information

Chapter 02: Using Data

Chapter 02: Using Data True / False 1. A variable can hold more than one value at a time. ANSWER: False REFERENCES: 54 2. The int data type is the most commonly used integer type. ANSWER: True REFERENCES: 64 3. Multiplication,

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

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators,

Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators, Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators, Expressions, Statements and Arrays. Java technology is: A programming

More information

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1 Name SOLUTION Page Points Score 2 15 3 8 4 18 5 10 6 7 7 7 8 14 9 11 10 10 Total 100 1 P age 1. Program Traces (41 points, 50 minutes)

More information

Java Basic Programming Constructs

Java Basic Programming Constructs Java Basic Programming Constructs /* * This is your first java program. */ class HelloWorld{ public static void main(string[] args){ System.out.println( Hello World! ); A Closer Look at HelloWorld 2 This

More information

CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) "2"

CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) 2 CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 1. For each Java expression in the left hand column, indicate its value in the right hand column. Be sure to show a constant

More information

Software Practice 1 Basic Grammar

Software Practice 1 Basic Grammar Software Practice 1 Basic Grammar Basic Syntax Data Type Loop Control Making Decision Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim (42) T.A. Sujin Oh Junseong Lee (43) 1 2 Java Program //package details

More information

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are

More information

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming

More information

1. Escape Sequences For each of the following snippets of code write down what will be printed on the screen.

1. Escape Sequences For each of the following snippets of code write down what will be printed on the screen. ComS 207: Programming I Homework 2 Out: Wed. Aug 30, 2006 Due: Fri. Sep 8, 2006 ( *BEFORE* the start of class) Student Name: Recitation Section: 1. Escape Sequences For each of the following snippets of

More information

First Java Program - Output to the Screen

First Java Program - Output to the Screen First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the

More information