The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
Basic Java And OOP
1. Daniel Muhammad Idrees
www.techgrasp.pk
• Co-Founder of TechGrasp.pk
Email: enggdaniyal@hotmail.com
LinkedIn: www.linkedin.com/in/danielmidrees
Facebook: www.facebook.com/daniel.mi
2. What to Expect?
• Guidance
• Counseling
• Mentorship
www.techgrasp.pk
3. What not to Expect?
•Spoon Feeding!
www.techgrasp.pk
5. Variables
• Data Types
o Primitive Types
o Non-primitive Types
• Local Variables
o Choosing Data Type
o Declaring (String string;)
o Initializing (string = “Hello”)
• Access Modifiers
• Class (static) Variables
• Instance (non-static) Variables
www.techgrasp.pk
10. Remember!
• ‘=‘ and ‘==‘ are not SAME!
• Never use ‘==‘ instead of
equals() when comparing
reference types
www.techgrasp.pk
11. Controlling Flow of Execution
• Conditions
o if – else
o switch
• Loops
o for
o while
• Special Control Statements
o break, continue
o Return
o try-catch-finally
www.techgrasp.pk
13. Arrays
• Arrays
o Collection of Similar Items in Sequence
o Contains values or references
o Fixed, Finite Length
• Length
• Index
• Initialization
• Enhanced for loop
www.techgrasp.pk
17. Pillars of OOP
• Inheritance
o Is-A and Has-A Relationship
• Polymorphism
o Method Overriding
• Using super keyword
o Method Overloading
www.techgrasp.pk
18. Pillars of OOP
• Abstraction
o Biggest Challenge in OOP
o Hiding complexity
o Abstract and Concrete Classes
• Encapsulation
o Hiding Internal Details
o Relevant Attributes and Behavior
o Access/Mutate (simply, get/set)
www.techgrasp.pk
19. Interfaces
• Why No Multiple Inheritance in Java?
• Interfaces are Contracts
• Rules
o No Instances
o No Constructors
o Only Method Signatures
o Only static final Members
www.techgrasp.pk
21. Read more JAVA from:
• Java Actually by Khalid A. Mughal
• The Complete Reference Java by Herbert Schildt
• http://www.tutorialspoint.com/java/
• http://javatpoint.com/java-tutorial
Take Help From:
• Stackoverflow
• Google!
www.techgrasp.pk
22. What we have covered:
• Variables
• Data types
• Access Modifiers
• Operators
• Controlling Flow of Execution
• Function
• Array
• Pillars of OOP (Abstraction, Inheritance, Polymorphism,
Encapsulation)
• Interfaces
• Exception Handling
www.techgrasp.pk
23. What I expect from you
• Learn
• Adapt
• Share
• Team Work
• Lead
• Make a Difference
www.techgrasp.pk