**Basics in Java**
OOP:
- It is the core of Java.
- It has four types Encapsulation,Inheritance,polymorphism,abstraction.
Abstraction:
- It is used to hide certain details and show essential features of the object.
- A powerful way to manage abstraction is through the use of hierarchical classifications.
Encapsulation:
- It is a mechanism of wrapping data (variables) and code acting on the data (methods) together as a single unit.
Inheritance:
- One object acquires all the properties and behaviors of an object
- create a new class that built upon the existing new class.
- Inherited class is called parent class or super class and new class is called child class or sub class.
Polymorphism:
- It is the ability of an object to form many forms.
- Parent class reference extends to child class reference.
- An object that can pass more than one IS-A test is polymorphic.
Entering the program in java:
- source file is very important.
- source file is a compilation unit.
- It contains one or more class definitions.
- dot java file name extensions is applied
- file name corresponds to class names may seem arbitary.
24/7/17
Closer Look at Program:
- It supports three styles of comments such as multiline comment,single line comment and document comment.
- Multiline - It shows at the top of the program.(longer remarks)
- This comment begins with /* and ends with */.Anything between this lines ignored by the compiler.
- It use class object without any instance class of the object such as keyword class.
- Single line - It begins with // and ends with the end of line.(line by line descriptions)
Document
main()-starting place of the program
println()-display the string which passed to it.
system.out-
system-predefined class that provides access to the system.
out-output stream connected to console.
All statements in java ends with semicolon.
First } ends the main function and next } ends the class definitions.
If statements:
- Condition is a boolean expression.If condition is true it is executed or else it is bye passed.
For loop:
- For loop contains iteration,initialization,condition of these three statements.
Literal:
- A constant value is represented by literal
- x is an character constant
- 100 is integer
- "sub" is an string