OOPS
what is oops ?
-OOP stands for object oriented programming language
-The main purpose of oops is to deal with real world entity using programming language
feactures -
1-class logical entity
2-object obj is a instance of class
3-inheritance
4- polimorphism
5-Encapsulation
6- Abstration
JAVA COMMENTS
Commets are the statements that totally ignore by the compiler
Why we use comments?
Provide explanation of total program.
Comments make program readable .
Types
1 single line commets //
2 multi line comment /* …..*/
3 documantation comment /**….*/
DATATYPES:-
Type of variable
Datatypes specifies the diff sizes and values can be store in variable
1 primitive datatype
Byte short int long float double char boolean
2 user defined
Class ,Interface, Arrays ,string
Variables in java
This is a user defined name which is given by user
Variable can store any type of value
Types of variables
1 local
Variable declared inside the body of method or method of parameter
Void fun (int a){
Int a;
2 static
The veriable is cdeclared with static keyword
Static int a;
3 intence
Veriable is decleared inside in the class but outside of the methods
Class A{
Int a ;
Public ststic void main()
}}
Typecasting
Convert one datatype to another datatype
Types:-
1 implicite
It is auto matically performed by the compiler
Int a=3; double b=a ; output a=3,b=3
2 explicite
By default the compiler doesn’t allow the explicit typecasting
double a=10; int b=(int)a; output a=10 b=10
TOKEN
Token is the smallest element of java
Keyword
Identifires
Operators
Separator
Literal
KEYWORDS
Reserved words in java
IDENTIFIRE
Name of variable method class package
Operators:-
DECISION MAKING STATEMENT
1 IF statement 2 switch stmt
If multiple choice statements
If-else
If else ladder
Nested if -else
LOOPING STMT
1-While
2-Do while
3-For
4- For-each
Advance version of for loop
Mainly used to featch the values from a collection like array
Syntax for (datatype var1: var2)
ARRAY
Methods –
-toString() as it is array print
-asList() as it is array print both are use in single dime ntion array only
-deepToString() this is used in multidmention array
sort() if we use after decleare array [Link]() method then it will automatically sort array
in asending order
Equals()
Compare the two arrays with the help of [Link](arr1,arr2)
In that we use Boolean for check ans in true or false type
copyOf()
copy all elements in to the array that given int arr2[]= [Link](arr1 , siize_of_array)