Your SlideShare is downloading. ×
Mobile Software Engineering Crash Course - C02 Java Primer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Mobile Software Engineering Crash Course - C02 Java Primer

247
views

Published on

Published in: Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
247
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mobile Software EngineeringL02 – Java Primer Mohammad Shaker FIT of Damascus - AI dept. MohammadShakerGtr@gmail.com Mobile SE – August 2012
  • 2. IDEeclipse, netbeans, etc.
  • 3. eclipse
  • 4. eclipse Juno, 2012
  • 5. btw, why eclipse?!
  • 6. eclipse Download http://www.eclipse.org/
  • 7. eclipse Download
  • 8. eclipse Juno – Packages and Projects
  • 9. JavaJVM – Java Virtual Machine
  • 10. JavaWrite once, run anywhere
  • 11. Javaeverything is an object! Or is it?
  • 12. Javaeverything is an object! Or is it?
  • 13. API http://java.sun.com/javase/6/docs/api/ Tutorialhttp://java.sun.com/docs/books/tutorial/java/TOC.html
  • 14. Variables - Naming• Subsequent characters also can be numbers• Case sensitive• No spaces• Examples: name firstName phoneNumber
  • 15. Reserved Wordsabstract continue for new switchassert*** default goto* package synchronizedboolean do if private this break double implements protected throw byte else import public throws case enum**** instanceof return transient catch extends int short try char final interface static void class finally long strictfp** volatile const* float native super whilehttp://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
  • 16. Primitive Typesbyteshortintlongfloatdoublebooleanchar
  • 17. Primitive Typesbyteshortint Everythinglong is anfloat object?doublebooleanchar
  • 18. Primitive Typesbyteshortint Everythinglong is anfloat object?doublebooleanchar
  • 19. ObjectsStringBigDecimal
  • 20. Arraysint[] grades;grades = new int[15];
  • 21. Control flowif (boolean) { // perform this code} else { // otherwise, run this}
  • 22. Example on first step!Car myCar = new Car();
  • 23. Example on first step!Car myCar = new Car();
  • 24. Example on first step!Car myCar = new Car();Car yourCar = myCar;Point loc = myCar.getLocation();
  • 25. New paradigms• Stack• Heap• Garbage collection
  • 26. Setters and Getters
  • 27. Let’s get our hands dirty
  • 28. Let’s get our hands dirty Objects
  • 29. Packages vs Namespaces
  • 30. void main(string[] args)
  • 31. Instance vs Class methods void shootBall(Point point) static void main(string[] args)
  • 32. Inheritance and Polymorphism extends, super, @Override
  • 33. Some diff.protected in a form of package scope not class scope
  • 34. Some diff.final vs const vs readonly
  • 35. interfaces
  • 36. Interfaces extends
  • 37. Collections
  • 38. http://docs.oracle.com/javase/tutorial/collections/interfaces/index.html
  • 39. ExampleArrayList<String> arrList = new ArrayList<String>();arrList.add(“A”);arrList.add(“AB”);arrList.add(“ABC”);arrList.add(“ABCD”);// using indicesarrList.set(0, arrList.get(1));arrList.set(1, “foo”);// out of bound?arrList.set(9, “bar”);
  • 40. Example• Suppose an ArrayList A1• What does the following line mean?List<String> list = new ArrayList<String>(A1);
  • 41. for-each Construct• Looping by indices• for-each, parallel execution for (Object o : collection) System.out.println(o);
  • 42. Collection OperationsList<Type> list1 = new ArrayList<Type>();// …List<Type> list2 = new ArrayList<Type>();// …List<Type> list3 = new ArrayList<Type>(list1);list3.addAll(list2);
  • 43. List Algorithms• sort — sorts a List using a merge sort algorithm, which provides a fast, stable sort. (A stable sort is one that does not reorder equal elements.)• shuffle — randomly permutes the elements in a List.• reverse — reverses the order of the elements in a List.• rotate — rotates all the elements in a List by a specified distance.• swap — swaps the elements at specified positions in a List.• replaceAll — replaces all occurrences of one specified value with another.• fill — overwrites every element in a List with the specified value.• copy — copies the source List into the destination List.• binarySearch — searches for an element in an ordered List using the binary search algorithm.• indexOfSubList — returns the index of the first sublist of one List that is equal to another.• lastIndexOfSubList — returns the index of the last sublist of one List that is equal to another. See more @ http://docs.oracle.com/javase/tutorial/collections/interfaces/list.html
  • 44. Iterators
  • 45. Multithreadingsynchronized, wait, notify, notifyall
  • 46. Exception Handling, IO...
  • 47. Design PatternsSingleton, Factory, Proxy, Template.. etc.
  • 48. Gang of four
  • 49. Implementing Singleton with Java “live”
  • 50. Thx for listening