Selenium Tutorial For Beginners 5|Java For Selenium – Overview of Java Programming|G C Reddy|


Video is ready, Click Here to View ×

Java Standard Edition or Core Java For Selenium, Overview of Java Programming, Comments in Java, Java Data Types, Variables in Java, Java Operators, Java Control Flow Statements, String Handling in Java, Arrays in Java, Java Built-in & User defined Methods, and Exception Handling in Java.
Java Object Oriented programming concepts like Inheritance, Polymorphism, Abstraction, and Encapsulation. Usage of Java Programming features in Automated Testing with Selenium.

5 thoughts on “Selenium Tutorial For Beginners 5|Java For Selenium – Overview of Java Programming|G C Reddy|

  1. Class Notes…
    Selenium Class 5: Java for Selenium – Overview of Java Programming
    i) Selenium Fundamentals
    ii) Java For Selenium
    iii) Selenium WebDriver
    iv) TestNG For Selenium
    v) Selenium Project
    > Selenium supports 6 programming languages for writing Test Scripts, we choose Java
    to write Test scripts. Java has nearly 77% Market shatre in Selenium Testing.
    > Java has 3 important Editions,
    i) Java Standard Edition/Core Java
    ii) Java Enterprise edition/Advanced Java
    iii) Java Micro Edition
    Note: Java Standard Edition/Core Java is enough for Selenium…
    Core Java / Java Standard Edition

    1) Comments in Java
    > To make the code Readable
    > To make the code disable from Execution
    Note: Java supports single line comment and multiple line comments
    2) Data Types in Java

    A Data Type is a classification of the Type of Data that a variable or Object can
    hold in Computer programming,

    Boolean etc…
    Java supports 2 Categories of Data Types,
    i) Primitive Data Types,
    ii) Non Primitive Data Types / Reference Data Types
    3) Java Modifiers

    Modifiers are used to set access levels for Classes, Variables, and Methods….

    Java supports two categories of modifiers

    i) Access Modifiers (default, public, private, and protected)
    ii) Non – Access Modifiers (static, final, abstract,….)
    4) Variables in Java

    A named memory llocation to hold / store temporary data within a program,

    Java supports 3 types of Varaibles,
    i) Local Variables
    ii) Instance Variables
    iii) Static / Class Variables
    Note: Java supports explicit declaration of Variables.
    In Java

    int a;
    b=200; //Error in Java
    In VBScript

    Dim a
    a =100
    b=200 'Correct in VBScript
    5) Operators in Java

    1) Operators are used to perform Mathematical, Comparison, and Logical operations

    Categories of Operators

    i) Arithmetic Operators
    ii) Assignment Operators
    iii) Relational Operators
    iv) Logical Operators
    v) Bitwise Operators
    vi) Miscellaneous Operators
    6) Java Control Flow Statements
    a) Conditional Statements (Ex: if…)
    b) Loop Statements (Ex: for…)
    c) Branching Statements (Ex: break…)
    a) Java Condtional Statements

    1) Two Types of Conditional Statements
    i) if statement
    ii) switch statement
    2) Three Types of Conditions

    i) Single Condition (Positive/Negative Condition)
    ii) Compound / Muliple Condition (Positive/Negative Condition)
    iii) Nested Condition (Positive/Negative Condition)

    3) Usage of Conditional Statements

    i) Execute a block of Statements when condition is true
    ii) Execute a block of statements when condition is true otherwise execute another
    block of statements
    iii) Execute a block of statements when a compound condition is true otherwise
    execute another block of statements
    iv) Decide among several alternates (else if)
    v) Execute a block of statements when more than one condition is true (nested if)
    vi) Decide among several alternates (using switch statement)
    b) Loop Statements

    Used for Repetitive Execution

    Four types of Loop Structures in Java

    i) for loop
    ii) while loop
    iii) do while loop
    iv) Enhanced for loop (Arrays)
    c) Branching Statements

    > Branching Statements are used to transfer control from one point to another in
    the code
    > Branching Statements are defined by the three keywords- break, continue,
    and return.

    Note: return statement is used in user defined methods (methods with return value),
    which returns a value, and return statement must be always last statement in the
    7) String handling in Java

    > Sequence of characters written in ""

    > String may contain Alpha bytes, numeric, Alpha-Numeric and Special characters.



    Using String Methods (pre-defined methods) we can perform operations on strings
    8) Arrays in Java

    > Generally, Array is a collection of similar type of elements

    > In Java, Array is an Object that contains elements of similar data types.

    > Java Array is index based, index starts from zero

    > The length of an Array is established when the Array is created, and Array
    length is fixed.

    > Each item in an Array is called as Element.
    9) IO Operations and File Handling in Java

    The package contains classes to perform Input and output operations.

    > Read Data using Input devices
    > Display output on the Console
    > Read data from files / write data

    Using Java File Class we can handle Text Files
    10) Java Methods

    What is Method?

    Set of statements to perform an Operation.

    Why Methods?

    Methods are used for code reusability.

    When we choose Methods?

    Whenever we want perform any operation multiple times then we choose Methods.

    Methods are also known as Functions

    > In structured Programming (Ex: C Language) we use Functions (Built-in, and User
    > In Object Oriented Programming (ex: Java language) we use Methods (Built-in and
    User defined)

    Two types of Methods

    i) Built-in Methods
    Number Methods
    Character Methods
    String Methods
    Arrays methods etc…

    ii) User defined Methods
    Method with returning value
    Method without returning any value
    In VBScript we use Built-in and User defined Functions for Code reusability

    In Java we use Built-in and User defined Methods for Code reusability
    11) Exception Handling

    In Computer Programming, Exception is an abnormal condition.

    > An exception is an event that occurs during the execution of a program that
    disturbs the normal flow of instructions.

    > The exception handling in Java is one of the powerful mechanisms to handle
    Run-time errors.
    int a =10;

    int a =10 (Syntax Error)

    int b = 10/2; (No Error)

    int c = 10/0; – Exception (Run-time error)
    12) Java Object Oriented Programming System (OOPS) Concepts

    Four fundamentals of OOPS

    i) Inheritance
    ii) Polymorphism
    iii) Abstraction
    iv) Encapsulation
    a) Inheritance

    > Inheritance is a mechanism in which one Object acquires all the properties and
    behaviors of Parent Object

    > Using Inheritance we can create classes that are built-in upon existing classes

    > When we inherit from an existing class, then we can reuse Methods and fields
    from the Parent class.

    Java Supports

    i) Single Inheritance
    ClassB extends ClassA

    ii) Multi Level Inheritance
    ClassB extends ClassA
    ClassC extends ClassB

    iii) Multiple Inheritance * Java doesn't support multiple inheritance.

    ClassB extends ClassA
    ClassB extends ClassZ
    b) Polymorphism

    Performing task/s in different ways.

    Polymorphism derived from two Greek words,

    Poly-means Many

    Morphs -means forms/ways

    So polymorphism means many ways.

    Two types of Polymorphism in Java

    a) Compile Time Polymorphism

    b) Run-time Polymorphism

    Note: We can achieve Polymorphism by Method Overloading and Method Overriding.
    c) Abstraction

    d) Encapsulation

Leave a Reply

Your email address will not be published. Required fields are marked *