Object oriented programming: (concept of object)
Object oriented programming is a paradigm provides many concepts such as inheritance, data
binding, polymorphism.
1) Inheritance:
Inheritance is a mechanism where a new class inherits properties and behaviour from an
existing class.
2) Polymorphism: allows object of different classes to be treated as object of a common super
class.
3) Abstraction: Removal of unnecessary data and information from the program.
Concepts in OOPS:
1) Object: Entity that has state and behaviour is called a subject.
2) Class: Collection of objects
3) Inheritance: When an object acquires all the previous aspects of the parent object
4) Polymorphism:
5) Abstraction
6) Encapsulation
Features of Java:
1)object oriented
2) simple
3) portable
4) platform independent
5) secured
6) robust
7) Architectural neutral
8) Dynamic
9) Interpreted
10) Hight performance
11) Multiheaded
12) Distrib
Variables: something that always varies case to case.
Data types: Integer
, float values : decimals;1.23
Characters : single letter eg: ‘a’, ‘&’
String: more than one letter
Boolean: Yes/ No or true or false
Operators are the symbols used for performing specific operations.
There 9 types of operators in java
1) Arithmetic operators: mathematical operations like (+,-,x,/)
2) Unary operators:
3) Assignment operator
4) Relational operators
5) Logical operators
6) Ternary operators
7) Bit-wise operators
8) Shift operators
Java Comments: used to describe the code more briefly to another person. Comments will
net be executed by the compiler and the interpreter.
Single line comment: only compatible to 1 line (starts with //)
Multiline comment: used for more than one line ( starts with /* and ends with */).
Java Variable Example: Add 2 numbers
class Simple{
public static void main(String[] args){
int a=10;
int b=10;
int c=a+b;
System.out.println c;
}
Types of Vareiables in java:
There are three types of variables in java:
1) Local variable:
2) Instance Variable
3) Static variable
Java Enum: contains a fixed number of constants
Eamples:
class EnumExample1{
public enum Season {WINTER,SPRING,SUMMER,FALL)
public static void main(String[] args){
for (Season s : Season.values)
Control Statements
Array: array is used to store a fixed sequential collection of elements of the same type.
Array index numbers will begin from 0-9.\
Java Console example:
Import java.io.Console;
Class ReadStringTest{
Public static void main