Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

myself

Rating
-
Sold
-
Pages
45
Uploaded on
06-12-2024
Written in
2024/2025

Notes of Java programming

Institution
Course

Content preview

Java Programming Notes CO4I

Chapter-1

1. Basic concepts of object oriented programming
The concepts of object oriented programming are as follows:


1. Classes

 A class consist of data and methods.
 A class is a collection of objects of similar type of objects.
 Classes are user defined data.
 Once class has been defined,we can create any number of object belonging to that class.
 Eg.
class Person
{
String name;
int age;
void accept( String n,int a)
{
name=n;
age=a;

}
void display()
{
System.out.println(“Name=”+name);
System.out.println(“Age=”+age);
}



2. Objects

 Objects are basic run time entities in object oriented system. They may represent a place, a bank
account, a table of data or any item that the program must handle.
 Objects are variables of class.
 Objects are generally used to access members (data and methods) of class.
 Eg. Person p =new Person()
Here p is an object of Person class


3. Data abstraction

 Data abstraction refers to act of representing essential features without including background
details or explanations.
 Classes use the concept of abstraction and are defined as the list abstraction attribute such as size,
weight and cost and function to operate on this attribute. They encapsulate all essential properties
of objects that they are to be created since the class used the concept of data abstraction they are

1

, Java Programming Notes CO4I
known as abstract data types(ADT).


4. Data encapsulation

 Data encapsulation means wrapping of data and functions into a single unit. It is most striking
feature of class. The data is not accessible to the outside world and only functions which are
wrapped in the class can access it.
 Thus insulation of data from direct access from program is called data hiding.


5. Inheritence

 Inheritence is the process by which object of one class can acquire the properties of the objects of
other classes. Inheritence means one class of object inherits the data and behavoiur(methods)
from another class .
 The old is refered as a base class and new one is called as derived class. The new class has
combined features of both the classes.


6. Polymorphism

 Polymorphism is the ability to take more than one form.
 For eg: an operation may demonstrate different behaviour in different instance. The behavior
depends upon the type of data used in the operation. As addition of two integer numbers gives
addition while addition of two strings gives concatenation.


7. Dynamic binding

 Binding refers to the linking of a procedure call to the Procedure definition (code) to be executed
in response to the call.
 Binding is classified as static binding and dynamic binding.
 Static binding means that the code associated with given procedure call is known at compile time.
 Dynamic binding means that the code associated with given procedure call is not known until the
time of the call at run time.
 Dynamic binding associated with polymorphism and inheritance.

8. Message Passing

 Message passing involves specifying the name of object, the name of the method and the
information to be sent.
 Example:.
p.accept(“abc”,18);

Here p is an object of Person class.
Accept is message
Arguments is information
1.1 Benefits of OOP

2

, Java Programming Notes CO4I
 OOP emphasis on data rather than procedure.
 Programs are divided into objects.
 Objects are characterized by functions or data structure that operates on data.
 Functions that operates on the data of an object are tied together in the data structure.
 Data is hidden and cannot be accessed by external functions.
 Objects may communicate with each other through functions.
 New data and functions can be easily added whenever necessary.
 Follows bottom-up approach in program design.

2. Java Features:
1. Compiler/Interpreter
 Java Source Code (.java file) is compiled to byte codes(.class file) that are interpreted by a Java
virtual machines (JVM) .
 This provides portability to any machine for which a virtual machine has been written.
 The two steps of compilation and interpretation allow for extensive code checking and improved
security.

Java source code Java Compiler Byte code Interpreter Machine code
(.java file) (javac) (.class file) (java)




2. Platform Independence
 Java byte code achieves the Write-Once-Run-Anywhere approach so running on different
platforms is possible. As we know java is both compiler & interpreter based language. Once the
java code also known as source code is compiled, it gets converted to Byte Code which is
portable & can be easily executed on all operating systems. Byte code generated is basically
represented in hexa decimal format in .class file. This .class file contains bytecode which is
executed JVM(Java virtual machine) which is a runtime environment for java. Now this .class file
can be run in any environment with the help of JVM and JVM convert bytecode into native
code.




Java Virtual Machine like its real counter part, executes the program and generate output. To
execute any code, JVM utilizes different components. JVM is divided into several components
like the stack, the garbage-collected heap, the registers and the method area.



3

, Java Programming Notes CO4I




Above fig. shows that JVM for different operating system is different.The JVM must translate the
bytecode into machine language, and since the machine language depends on the operating
system being used, it is clear that the JVM is platform (operating system) dependent – in other
words, the JVM is not platform independent.

3. Object Oriented
 Supports all the concepts of object oriented programming language like object classes,
polymorphism etc.
 Java is pure object oriented Language – Each and every code in java comes under a class,
including main().
 Following is the example shows that even main function is comes under a class:

class Demo
{
public static void main(String args[])
{
System.out.println(“hello”);

}
}

4. Robust and Secure
 Exception handling built-in, strong type checking (that is, all data must be declared an explicit
type), local variables must be initialized.
 Automatic Memory Management
o Automatic garbage collection - memory management handled by JVM.

 Java is secure as several dangerous features of C & C++ eliminated
o No memory pointers
o No preprocessor
o Array index limit checking

5.Dynamic Binding


4

Written for

Institution
Course

Document information

Uploaded on
December 6, 2024
Number of pages
45
Written in
2024/2025
Type
Class notes
Professor(s)
Mahesh
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
mayurpm05

Get to know the seller

Seller avatar
mayurpm05 myself
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions