2. CONTENT
▪ What is OOP
▪ Advantages of OOP
▪ What is JAVA
▪ Where is Java used
▪ Java Program Translation
▪ Java Program Structure
▪ Data Type in Java
▪ Conditional Control Statement
▪ Loop Control Statement
▪ Class, object, method in java
▪ Constructor
2
3. WHAT IS OOP
▪ OOP stands for Object-Oriented Programming
▪ Procedural programming is about writing procedures or
methods that perform operations on the data, while
object-oriented programming is about creating objects
that contain both data and methods.
3
4. ADVANTAGES OF OOP
• OOP is faster and easier to execute
• OOP provides a clear structure for the programs
• OOP helps to keep the Java code DRY "Don't Repeat
Yourself", and makes the code easier to maintain, modify
and debug
• OOP makes it possible to create full reusable applications
with less code and shorter development time
4
5. WHAT IS JAVA
• Java is a programming language and a platform.
• Java is a high level, highly powerful, secure and object oriented
programming language
• Java was developed by a team led by James Gosling at Sun
Microsystems.
• Java is a first programming language which provide the concept of
writing programs that can be executed using the web.
5
6. WHERE IS JAVA USED
• Mobile applications (specially Android apps)
• Desktop applications
• Web applications
• Web servers and application servers
• Games
• Database connection
• And much, much more!
6
8. JAVA PROGRAM STRUCTURE
8
Documentation Section(Optional)
Package Statement
Import Statements(Optional)
Class Definition
Inheritance Statements(Optional)
Interface Statements(Optional)
Main method class(Essential)
{
main method definition
}
9. DATA TYPES IN JAVA
9
Data Types
Primitive Non-Primitive
Numeric Non-Numeric
Integral Type Floating Point Boolean Char
byte int short long float double
Array String Class Interface
Data Types
Primitive Non-Primitive
Numeric
10. CONDITIONAL CONTROL STATEMENT
▪ Conditional statements define conditions that are true or false and
then execute based on whether or not the condition is true.
Basically, conditions say, “If x is true, then execute y”. This logic is
called an “if-statement”.
▪ There are some conditional statements:
1. If
2. If else
3. Else if
4. Switch
10
15. LOOP CONTROL STATEMENT
▪ With loop control statements, you can repeatedly execute a block of
code.
▪ There are four loop Statements
1. For loop statement
Syntax : for(init; condition; incr/decr){
// code to be executed
}
2. While loop statement
Syntax : while(condition){
//code to be executed
}
3. Do-while statement
Syntax : do{
//code to be executed
} while(condition);
4. Continue
15
19. CLASS, OBJECT, METHOD IN JAVA
▪ Everything in Java is associated with classes and
objects, along with its attributes and methods. For
example: in real life, a car is an object. The car
has attributes, such as weight and color, and methods,
such as drive and brake.
▪ A Class is like an object constructor, or a "blueprint"
for creating objects.
19
20. CLASS DECLARATION
▪ Class declaration syntax:
class ClassName
{
Member Variable Declaration;
Member Function
}
20
▪ Example:
class Student //classname
{
int Roll; // Member Variable
String Name; // Member Variable
float Mark; // Member Variable
void GetData() //Member Function
{
//Body of the Method
}
} //End of the Class
21. OBJECT DECLARATION
▪ Initializing an object means storing data into the object from
class.
▪ Syntax
className objectName = new className();
▪ Example:
Student obj = new Student(); //Student is className and obj is ObjectName
21
22. METHOD DECLARATION
▪ A method is a block of code which only runs when it is called.
▪ You can pass data, known as parameters, into a method.
▪ Methods are used to perform certain actions, and they are also
known as functions.
▪ Syntax
modifier returnType nameOfMethod (Parameter
List)
{
// method body
}22
23. CONSTRUCTOR DECLARATION
▪ Constructor looks like a method but it is in fact not a method. It’s
name is same as class name and it does not return any value.
▪ Syntax
class className
{
private members;
protected members;
public className()
{
//Body
}
23
শর্তাধীন বিবৃতি শর্তগুলি সংজ্ঞায়িত করে যা সত্য বা মিথ্যা এবং তারপরে শর্তটি সত্য কিনা এর ভিত্তিতে সম্পাদন করে। মূলত শর্তাবলী বলে, "যদি এক্স সত্য হয় তবে y চালিত করুন"। এই যুক্তিটিকে একটি "যদি বিবৃতি" বলা হয়।