notes110106 - string class String s =...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 heres a while loop, write a for loop study the assignments for do while loops custom methods week 3 part 1 and 2 arithmetic operators 5%2 = 1 7%6 = 1 9%3 = 0 ranking operators i=0 i+=3 == i=i+3 increment operator i++ == i+1 switch statements //more than 3 else ifs if statement <>= no escape java packages, api import statements variable naming convention azAZ09 _ $ primitive data types, objects and variables primitive = 8, 6 are numeric(byte short int long double float), boolean char Err:510 java numeric primitive types (no need with ranges, but know how big, no precision) char short = 16 bits java contains unicode chars 16bit mixed type arithmetic int and long ( "asdfs" + <--
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 final Double PI = 3.14 //(named constant) make it uppercase
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: string class String s = &quot;dsfljklsdfsd&quot; char c = s.charAt(4) char c = 'Q' compare characters if (c==&quot;l&quot;){ } A&amp;&amp;B //&amp;&amp; - logical AND compare string objects s.equals Teinary operator e1 ? e2:e3 if(e1){ e2} else{ e3 } up to half ch5 reading from file FileReader fr = new . ....(&quot;file.txt) BufferReader br = new . ..... (fr) String s = br.readLine() while (s != null){ s = br.readLine() } writing to file FileWriter fw = new FileWriter(&quot;file.txt&quot;) PrintWriter pw = new PrintWriter(fw) pw.println(&quot;sdfsd&quot;) pw.close() fw.close() Sheet1 Page 3 Sheet1 Page 4 //=l //char is primitive, no need for &quot;new&quot; //returns string //do the first one first...
View Full Document

Page1 / 4

notes110106 - string class String s =...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online