JAVA Object Oriented Programming (OOP)
Object Oriented Programming (OOP)
What is OOP?
Object=Properties (state)+ Behaviors
class Java {
string str;
public void () {
}
}
Class name standards: -
Class names in Java are typically written in Pascal Case, which means the first letter of each word in the class name is capitalized, and there are no spaces or underscores between words.
class Java {
string str;
public void test(){
}
}
example☝: - "Java " in pervious code.
or
and other identifiers in Java are typically written in
camelCase, which means the first letter of the first word is in lowercase, and
the first letter of each subsequent word is capitalized.
public class nameAli{
string str;public void test(){
}
}
example☝: - "nameAli"
What is a Variable?
Variable standards: -
type variable_Name = value;
What is a Method?
Java methods are blocks of code that perform a specific task and can be called by other parts of the program.
Methods can be used to keep the things (behaviors) that the object can do
inside the class, which is the blueprint for creating objects.
Why use methods? To reuse code: define the code once, and use it many times.
Method standards: -
In Java, when defining a method, you are required to include parentheses ( ) after its name, and these parentheses are used to enclose the method's parameter list. This is a fundamental part of Java's method syntax.
public class Main {
static void myMethod() {
}
}
Java has a set of keywords that are reserved words that
cannot be used as variables, methods, classes, or any other identifiers.

Comments
Post a Comment