Professional Documents
Culture Documents
Notes
Notes
Notes
Concept of Object
Object
• What is an Object :
An object can be defined as an entity having a specific identity, specific character, and specific behavior.
Example of Object:
"You' are also an example of object. Your unique identity is your name. Your characteristics are you have eyes,
ears, nose, hands, legs, heart, brain, liver....etc Your behaviour is: you can walk, talk, eat, sleep, sing, dance,
etc.
• Class
A CLASS IS A BLUEPRINT THAT SYMBOLISED a set of objects that shared common structure and common behaviour.
• Object Factory
A producer of objects that accepts some basic information and creates objects based on this information
Data Abstraction
• Data Abstraction:
DATA Abstraction is an act of representing essential features without including the background details or
explanation
Example of Abstraction:
Take another example of a 'switchboard'. You just press certain switches according to your requirement. What
is happening inside, how it is happening what the internal circuit is etc. you needn't know. Again this is
abstraction, you know only the essential things to operate on switchboard without knowing the background
details of switchboard.
The only way to access the data is provided by the function that are combined along with the data this function are called
methods or Member function in object-oriented language
In an object,
(i) there are variables to hold data, called member variables.
(ii) the values of these member variables define the state of an object.
(iii) there are member functions/operations/methods that define the behaviour of objects.
When the objects require, they pass/request information to one another. This interaction is called message passing.
• Method
A member function is also called as Method.
• Message
A way of Sending/Receiving information to/From another object.
Machine Language:
computer was developed to carry out that word written in which language called language machine language
instructions are expressed as binary language called machine code.
It's sequence of Zeros and ones.
A computer can directly execute a program only if is written own machine language.
Assembly Language:
Consists of mnemonic codes.
Assembler converts Assembly language to machine language.
Java compilation processes is different from traditional compilation process as it converts the machine code for a virtual
machine known as JVM on the Java Virtual Machine the machine code for JVM is called bytecode it has the extension
called .java the bytecode and needs Java interpreter to convert it into the machine code of the computer on which it is to be
executed this interpreter is a part of JVM
JVM also includes JIT (just-in-time) compiler that compiles selected portion of bytecode into executable code the remaining
code is simply interpreted
JRE (Java Runtime Environment) JVM along, with the many other classes libraries constitutes the JRE
features of Java
Java consists of many features, some important features are
object-oriented
Because it treat everything as object
Robust
Allocation and de-location of data is automatic
platform independent
"Write once run anywhere" As java applications can run on platform that has corresponding JVM installed in it.
simple
It is easy and simple to learn
Character Set:
Alphabets: letter, A-Z (Uppercase) and (LowerCase);
Number: digit(0-9);
Special characters: ?, %,],},> etc;
Token
• All character in a Java program are grouped into symbol called Token
These are the smallest individual in a program.
Token
Keywords Identifiers Literals Punctuators Operators
Keywords in Java
keywords are also known as reserved words that have a special meaning to the Java compiler
Java compiler reserves these words for its own use and hence they are not available for being the
name of the variable or method
Identifiers in Java
Identifiers are fundamental building blocks of a program and are used to name different components of a program such as
variable ,method and object
for example public class welcome here welcome is the identifier
Literals
Literals are sequence of character that represent value in program and store in variable
literals are made up of digits letters and other characters
Java supports following are types of literals numeric non-numeric Boolean and null
numeric literals are values that are consists of digits 0 to 9 a decimal point a positive or negative sign they are of two types
integer or real literals integer literal shows numeric values which are whole only
the real literals shows the floating points literals as they represents value with the decimal point
Operator in Java
Operators are symbols used to perform a mathematical or logical operation on a given expression The variable literals are
combined to build an expression.
• Unary Operator:
A unary (meaning only one) operator requires only one operand.
E.g. = , -, ++, --,!'
• Binary Operator
A binary(meaning only two ) operator requires two operands.
E.g. =, -, %, &&
• Ternary operator
A ternary (meaning only three ) operator requires three operands.
E.g. ? :
Types of Operator
A static method is a method that belongs to a class, but it does not belong to an instance of that class and this method can be called without the instance or object of that class.
Every method in java defaults to a non-static method without a static keyword preceding it. non-static methods can access any static method and static variable also, without
using the object of the class.
From <https://www.geeksforgeeks.org/difference-between-static-and-non-static-method-in-java/>
From <https://www.geeksforgeeks.org/difference-between-static-and-non-static-method-in-java/>