Numbers Normally when we work with Numbers we


Numbers Normally, when we work with Numbers, we use primitive data types such as byte, int, long, double, etc. Example int i = 5000; float gpa = 13. 65; Byte mask = 0 xaf;

Numbers
![Numbers public class Test{ public static void main(String args[]){ Integer x = 5; // Numbers public class Test{ public static void main(String args[]){ Integer x = 5; //](http://slidetodoc.com/presentation_image_h2/46ea7eee93cbaa2060663adf5a5802d3/image-4.jpg)
Numbers public class Test{ public static void main(String args[]){ Integer x = 5; // boxes int to an Integer object x = x + 10; // unboxes the Integer to a int System. out. println(x); } }

Character Example: char ch = 'a'; // Unicode for uppercase Greek omega character char uni. Char = 'u 039 A'; // an array of chars char[] char. Array ={ 'a', 'b', 'c', 'd', 'e' };

Escape Sequences: Escape Sequence Description t Inserts a tab in the text at this point. b Inserts a backspace in the text at this point. n Inserts a newline in the text at this point. r Inserts a carriage return in the text at this point. f Inserts a form feed in the text at this point. ’ Inserts a single quote character in the text at this point. ” Inserts a double quote character in the text at this point. \ Inserts a backslash character in the text at this point.
![Escape Sequences: public class Test { public static void main(String args[]) { System. out. Escape Sequences: public class Test { public static void main(String args[]) { System. out.](http://slidetodoc.com/presentation_image_h2/46ea7eee93cbaa2060663adf5a5802d3/image-7.jpg)
Escape Sequences: public class Test { public static void main(String args[]) { System. out. println("She said "Hello!" to me. "); } } She said “Hello!” to me.

Strings • Creating String: String greeting = “Hello world”; • String Length: String name = “Peter parker"; int len = name. length(); System. out. println( "String Length is : " + len );
![Array • Declaring Array Variables: data. Type[] array. Ref. Var; // preferred way or Array • Declaring Array Variables: data. Type[] array. Ref. Var; // preferred way or](http://slidetodoc.com/presentation_image_h2/46ea7eee93cbaa2060663adf5a5802d3/image-9.jpg)
Array • Declaring Array Variables: data. Type[] array. Ref. Var; // preferred way or datatype array. Ref. Var[]; // works but not preferred way
![Arrays • Creating Arrays: • array. Ref. Var = new datatype[array. Size]; • data. Arrays • Creating Arrays: • array. Ref. Var = new datatype[array. Size]; • data.](http://slidetodoc.com/presentation_image_h2/46ea7eee93cbaa2060663adf5a5802d3/image-10.jpg)
Arrays • Creating Arrays: • array. Ref. Var = new datatype[array. Size]; • data. Type[] array. Ref. Var = new data. Type[array. Size]; OR • data. Type[] array. Ref. Var = {value 0, value 1, . . . , valuek};
![Array • Example: double[] my. List = new double[10]; Array • Example: double[] my. List = new double[10];](http://slidetodoc.com/presentation_image_h2/46ea7eee93cbaa2060663adf5a5802d3/image-11.jpg)
Array • Example: double[] my. List = new double[10];

Arrays • Processing Arrays:

Arrays • The foreach Loops: JDK 1. 5 introduced a new for loop. Exanple:

Q&A The End
- Slides: 14