Basic To Advanced Selenium Java Full Course - Session 2 - Java Language Basics

preview_player
Показать описание
Type Casting:
Converting a value from one data type to another is called Type Casting

Widening or Automatic Type or Implicit Conversion:
Converting a lower data type into higher one is called widening type casting
Two data types are converted automatically
Two data types are compatible
Assigning value of a smaller data type to bigger data type
byte -- short -- int -- long -- float -- double

Narrowing or Explicit Conversion:
Assigning a value of larger data type to a smaller data type is called explicit
type casting
Used for incompatible data types
double -- float -- long -- int -- short -- byte

Control Flows:
A program’s control flow is the order in which the program’s code is executed
Code execution flow can be changed by including control flow statements and conditions
Conditions determine how many times a line of code gets executed
Java provides 3 types of control flow statements:
Decision making statements - If, if else, else if
Loop statements - while, do while, for
Jump statements - break, continue

If Else Statement:
An if statement is a control flow which performs some action when condition is true
An else statement only runs when the condition is false

While Loop:
Loop executes a block of code repeatedly based on the condition
While Loop: It is a control flow statement that allows code to be executed as long as a given
condition is true

Do While Loop:
It is similar to while loop but checks the condition after the statements are executed
All statements are executed until the condition is false and loop terminates
It will execute the statement at least once

For Loop:
For statement provides a compact way to iterate over a range of values. It
repeatedly loops until a particular condition is satisfied.

For Each Loop:
Enhanced for loop can be used to iterate through the elements of a
collection or an array

Break & Continue Statements:
Break statement is used to terminate the loop and return the control
to first statement after the loop.
Continue statement is used to skip the current iteration of the loop
and jump to the next iteration of the loop. It can be used with any
type of loop like for, while and do while loop.

Methods:
Method is a block of code which performs a specific task
Methods help developers organize their code
Methods help us to define a task and reuse it throughout our code

Built In Methods:
Java has already defined many methods in its library
These methods are called built in methods
Built in methods can be used by just calling them
Use dot operator to get access to many built in method

Рекомендации по теме
welcome to shbcf.ru