Android apps to use in appium android test examples

Breaking

Saturday, August 11, 2018

Java Tutorial For Beginners


Java Basics too OOPS Concepts
 

A) Java Fundamentals

1) Comments inwards Java
    

    > To brand the Code Readable
    > To brand the Code disable from Execution.

Java supports Single trouble comment too multiple trouble comments.
---------------------------------------------------
2) Data Types inwards Java
 

A Data Type is a classification of the type of information that a variable or object tin concord inwards reckoner programming.

Example:

Character,

Integer,

String

Float

Boolean etc...

Java supports 2 categories of Data types.

a) Primitive Data Types

b) Reference Data Types.
---------------------------------------------------
3) Java Modifiers
 

Modifiers are used to laid access levels for Classes, Variables too Methods etc...

Two types of Modifiers inwards Java

i) Access Modifiers (default, public, mortal too protected)

ii) Non Access Modifiers 9static, final, abstract, synchronized etc...)
---------------------------------------------------
4) Variables inwards Java
 

A named retentiveness place to shop temporary information inside a program.

Three types of variables inwards Java

i) Local Variables

ii) Instance Variables

iii) Class / Static Variables
---------------------------------------------------
5) Operators inwards Java
 

Operators are used to perform Mathematical, Comparison too Logical Operations.

Categories of Operators inwards Java

i) Arithmetic Operators

ii) Relational Operators

iii) Assignment Operators

iv) Bitwise Operators

v) Logical Operators

vi) Miscellaneous Operators
---------------------------------------------------
Flow Control
    Conditional Statements
    Loop Statements
---------------------------------------------------
6) Java Conditional Statements
 

a) Two types of statements

i) if statement

ii) switch statement
-----------------------
b) Three types of Conditions

i) Single Condition (Positive/Negative)

ii) Compound Condition (Positive/Negative)

iii) Nested Condition (Positive/Negative)
---------------------------------------
c) Usage of Conditional Statements

i) Execute a block of statements when a status is true.

ii) Execute a block of statements when a status is true, otherwise execute to a greater extent than or less other block of statements.

iiii) Execute a block of statements when a Compound status is true, otherwise execute to a greater extent than or less other block of statements.

iv) Decide amid several alternates (Else if)

v) Execute a block of statements when to a greater extent than than 1 status is truthful (Nested if).

vi) Decide amid several alternates using Switch statement
---------------------------------------------------
7) Java Loop Statements
 

Used for Repetitive execution.

Four types of loop structures inwards Java

i) for loop

ii) patch loop

iii) exercise patch loop

iv) Enhanced for loop(Arrays)
---------------------------------------------------
8) Arrays inwards Java
 

> Generally, Array is a collection of like type of elements.

> In Java, Array is an Object that contains elements of like information type.

> Java Array is index based, index starts from zero.

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

> Each item inwards an Array is called an Element.
---------------------------------------------------
9) String treatment inwards Java
 

> Series of characters written ""

> String may incorporate Alfabytes or Alfa-numeric or Alfa-numeric too Special characters or entirely numeric.


"ABCD"
"India123"
"India123$#@"
"123"
---------------------------------------------------
10) IO Operations too File Handling inwards Java
 

The java.io parcel contains classes to perform Input too Output operations.

> Read information using Input devices.

> Display output on the Console.

> Read information from files / write information

Using Java File shape nosotros tin handgrip Text files.
---------------------------------------------------
11) Java Methods
 

Methods are besides known every bit Functions.

> In Structured Programming (Ex: C Language) nosotros exercise Functions (Built-in too User defined)

> In Object Oriented Programming (Ex: Java Language) nosotros exercise Methods (Built-in too User defined)

Two types of Methods inwards Java

a) Built inwards Methods
    Number Methods
    Character Methods
    String Methods
    Array Methods etc...

b) User defined Methods
    Method amongst returning value
    Method without returning whatsoever value.
---------------------------------------------------
12) Regular Expressions
 

It is a formula for matching patterns, Influenza A virus subtype H5N1 Regular human face defines search designing for Strings.

Java provides java.util.regex parcel for designing matching

Constant matching

india.doc - india.doc

Pattern matching

i*.

ia.....
ib....
.
.
india.doc
---------------------------------------------------
13) Exception Handling inwards Java
 

In Computer Programming, Exception is an abnormal condition.

> An exception is an final result that occurs during the execution of a program, that disturbs the normal period of time of instructions.

> The Exception treatment inwards Java is 1 of the powerful machinery to handgrip Run-time errors.
---------------------------------------------------
B) Java Object Oriented Programming System (OOPS) concepts.
 

Four fundamentals of OOPS

1) Inheritance

2) Polymorphism

3) Abstraction

4) Encapsulation
---------------------------------------------------
1) Inheritance
 

> Inheritance is a machinery inwards which 1 Object acquires all the properties too behaviors of nurture Object.

> Using Inheritance nosotros tin exercise classes that are built-in upon existing classes.

> When nosotros Inherit from an Existing class, too thence nosotros tin reuse Methods too fields from Parent shape too nosotros tin add together New Methods too fields also.

Java Supports

i) Single Inheritance

ClassB extends ClassA

ii) Multi Level Inheritance

ClassB extends ClassA
ClassC extends ClassB

Java doesn't back upward Multiple Inheritance

ClassB extends ClassA
ClassB extends ClassZ
---------------------------------------------------
2) Polymorphism
 

Performing tasks inwards unlike ways.

Polymorphism derived from Two Greek words,

Poly - agency Many

Morphs- agency forms/ways

So Polymorphism agency many ways.

Two types of Polymorphism

i) Compile Time Polymorphism / Method Overloading

ii) Run-Time Polymorphism / Method Overriding
---------------------------------------------------
3) Abstraction
 

> Abstraction is a procedure of hiding implementation details too showing functionality to the user.

> It shows of import things to the user too hides implementation details

Ex:
Sending Email

> Abstraction focuses on what the Object does instead of how it does.

Abstraction tin endure achieved inwards 2 ways

i) Abstarct Class(1% to 100%)

ii) Interface (100%)
---------------------------------------------------
Class1
10 methods (10 concrete/complete Methods)

Class1 - Class
------------------------------
Class2
10 methods(1 Method -Abstact Method, nine Methods concrete/complete Methods)

Class2 -Abstact Class
---------------------------
Class3
10 Methods (10 Methods -Abstarct Methods)

Class3 -Abstact Class
---------------------------------------------------

4) Encapsulation
 

> Encapsulation is a procedure of wrapping code too information together into a unmarried unit.

Ex: Capsule (mixed of Several medicines)

Encapsulation provides command over the data.
---------------------------------------------------
Java Packages
A Java parcel is a similal type of classes, interfaces too sub packages.

Two types of packages

i) Built in
Ex: io, util, lang etc...

ii) User deined
-------------------------------------
Interfaces inwards Java
 

An Interface is a collection of Abstract methods.

An Interface is non a Class, writing an Interface is similat to writing a class, simply 2 are unlike things.
----------------------------------------
Java Programming hierarchy:
Java Project
    > Java Package
        > Java Class /Java Interface
---------------------------------------------------

Sumber http://www.gcreddy.com/

No comments:

Post a Comment