SlideShare a Scribd company logo
Course code: CSE208 - JAVA PROGRAMMING
1
What is java?
• Java is a general purpose, Object oriented programming Language
• Java is platform independent: the same program can run on any
correctly implemented Java system
• Java is object-oriented:
• Structured in terms of classes, which group data with
operations on that data
• Can construct new classes by extending existing ones
• Java designed as
• A core language plus
• A rich collection of commonly available packages
• Java can be embedded in Web pages
2
Reasons for using java
• Built-in support for multi-threading, socket communication, and
memory management (automatic garbage collection).
• Object Oriented (OO).
• Better portability than other languages across operating systems.
• Supports Web based applications (Applet, Servlet, and JSP),
distributed applications (sockets, RMI, EJB etc) and network
protocols (HTTP, JRMP etc) with the help of extensive standardized
APIs (Application Programming Interfaces).
3
Java and its Evolution
4
 Programming languages such as Cobol, Fortran do not have
structural principles. They use the Goto statement to control the
flow of the program.
 Therefore, ’C’ was invented in 1970, to replace the assembly
language and to create a structured, effective and high-level
language
 C++ came with object-oriented programming features. C++ is the
extension of C language which has been used extensively. It is a
powerful modern language that includes the power and simplicity
of C and the characteristics of OOP.
Java History
• Java is a general purpose, Object oriented programming Language developed by
Sun Microsystems of USA in 1991. Originally called Oak by James Gosling.
• 1990 – Sun Microsystems decided to develop special software for consumer
electronic devices headed by James Gosling.
• 1991 – Using C++ the team announced a new language named Oak.
• 1992 – The Green project team by Sun, shown new language to control home
appliances using hand held device with tiny touch-sensitive screen.
• 1993 - The www appeared on the internet and transformed the text based
internet into graphical rich environment using Web Applets.
• 1994 – Team developed a web browser called “HotJava” for web Applets.
• 1995 – “Oak” was renamed “Java” due to some legal snags. Java is just a name.
Netscape and Microsoft supports to Java.
• 1996 – Java established itself as a leader for internet & general purpose
programming. Java founds its home.
5
JAVA SE VERSION RELEASE DATE
JDK 1.0 Jan-96
JDK 1.1 Feb-97
J2SE 1.2 Dec-98
J2SE 1.3 May-2000
J2SE 1.4 Feb-2002
J2SE 5.0 Sep-2004
Java SE 6 Dec-2006
Java SE 7 Jul-2011
Java SE 8 Mar-2014
Java SE 9 September, 21st 2017
Java SE 10 March, 20th 2018
Java SE 11 September, 25th 2018
Java SE 12 March, 19th 2019
Java SE 13 September, 17th 2019
Java SE 14 March, 17th 2020
Java SE 15 September, 15th 2020
Java SE 16 March, 16th 2021
Java SE 17 September, 14th 2021
Java SE 18 March, 22nd 2022
Java SE 19 September, 20th 2022
Java SE 20 March, 21st 2023 6
Java Versions
7
Procedural Oriented Programming Object-Oriented Programming
In procedural programming, the program is divided into
small parts called functions.
In object-oriented programming, the program is divided
into small parts called objects.
Procedural programming follows a top-down approach.
Object-oriented programming follows a bottom-up
approach.
There is no access specifier in procedural programming.
Object-oriented programming has access specifiers like
private, public, protected, etc.
Procedural programming does not have any proper way
of hiding data so it is less secure.
Object-oriented programming provides data hiding so it
is more secure.
In procedural programming, overloading is not possible. Overloading is possible in object-oriented programming.
In procedural programming, there is no concept of data
hiding and inheritance.
In object-oriented programming, the concept of data
hiding and inheritance is used.
In procedural programming, the function is more
important than the data.
In object-oriented programming, data is more important
than function.
Procedural programming uses the concept of procedure
abstraction.
Object-oriented programming uses the concept of data
abstraction.
Code reusability absent in procedural programming,
Code reusability present in object-oriented
programming.
Differences between
C++ and Java
8
Sl. no COMPARISON PARAMETER C++ JAVA
1 Developed / Founded by
C++ was developed by Bjarne Stroustrup at
Bell Labs in 1979. It was developed as an
extension of the C language.
Java was developed by James
Gosling at Sun Microsystems.
Now, it is owned by Oracle.
2 Programming model
It has support for both procedural
programming and object-oriented
programming.
Java has support only for
object-oriented programming
models.
3 Platform dependence
C++ is platform dependent. It is based on the
concept of Write Once Compile Anywhere.
Java is platform-independent.
It is based on the concept of
Write Once Run Anywhere.
4 Features supported
C++ supports features like operator
overloading, Goto statements, structures,
pointers, unions, etc.
Java does not support features
like operator overloading,
Goto statements, structures,
pointers, unions, etc.
5 Compilation and Interpretation
C ++ is only compiled and cannot be
interpreted.
Java can be both compiled and
interpreted.
6
Library and Code reusability
support
C++ has very limited libraries with low-level
functionalities. C++ allows direct calls to
native system libraries.
Java, on the other hand, has
more diverse libraries with a
lot of support for code
reusability. In Java, only calls
through the Java Native
Interface and recently Java
Native Access are allowed.
7 Memory Management In C++, memory management is manual.
In Java, memory management
is System controlled.
9 Global Scope
In C++, both global and namespace scopes
are supported.
Java has no support for global
scope.
Java Environment
• Java Environment includes large number of development tools.
• The development tools are part of the system known as Java Development Kit (
JDK ).
• JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is
a software development environment which is used to develop java
applications and applets. It physically exists. It contains JRE + development
tools.
9
Java Runtime Environment ( JRE )
• The Java Runtime Environment ( JRE ) facilitates the execution of
programs developed in java. It comprises the following:
• Java Virtual Machine ( JVM ) :
• Java Virtual Machine (JVM) is an engine that provides a runtime
environment to drive the Java Code or applications. It converts
Java bytecode into machine language. This machine is called Java
Virtual Machine and it exists only inside the computer memory.
• Compiling source code into bytecode ( machine readable code )
using javac compiler.
• Executing the bytecode ( machine-readable code ) to human-
understandable code using a Java interpreter
10
Java’s Magic: The Byte Code
 Allows Java to solve both the security and the portability problems is that
the output of a Java compiler is not executable code but it is the Bytecode.
 Bytecode is a highly optimized set of instructions designed to be executed
by the Java run-time system, which is called the Java Virtual
Machine (JVM).
 JVM is an interpreter for bytecode. The fact that a Java program is executed
by JVM helps solve the major problems associated with downloading
programs over the Internet.
 Translating a Java program into bytecode helps makes it much easier to
run a program in a wide variety of environments. This is because only the
JVM needs to be implemented for each platform.
Java is Compiled and Interpreted
Text Editor Compiler Interpreter
Programmer
Source Code
.java file
Byte Code
.class file
Hardware and
Operating System
Notepad, emacs, javac java
appletviewer
Java is both compiled and an interpreted lang. First the java compiler translates source code into
the byte code instructions. In the next stage the java interpreter converts the byte code
instructions to Machine Code.
Java features/Java Buzzwords
• Simple
• Object-Oriented
• Portable
• Platform independent
• Secured
• Robust
• Architecture neutral
• Interpreted
• High Performance
• Multithreaded
• Distributed
• Dynamic
13
Simple
• Java is very easy to learn, and its syntax is simple, clean and easy
to understand.
• Java syntax is based on C++ (so easier for programmers to learn it
after C++).
• Java has removed many complicated and rarely-used features, for
example, explicit pointers, operator overloading, etc.
• There is no need to remove unreferenced objects because there is
an Automatic Garbage Collection in Java.
14
Secure
• Secure As compared to C/C++, Java is considered to be much more
secure language, as it does not allow a programmer to create
pointers. Thus in Java we cannot access any address directly and
this makes Java much more reliable and secure as compared to
C/C++.
• In Java, we can split a program into multiple parts and store these
parts on different computers.
15
Object-Oriented
• Java is an object-oriented programming language. Everything in Java is
an object.
• Object-oriented means we organize our software as a combination of
different types of objects that incorporate both data and behavior.
• Basic concepts of OOPs are:
 Object
 Class
 Inheritance
 Polymorphism
 Abstraction
 Encapsulation
16
Platform Independent/Architecture
Neutral
• Java is platform independent because it is different from other languages
like C, C++, etc.
• Being java independent means, Programme compiled n one machine that can be
executed in another machine without any change.
• The Java compiler never converts the source code to machine code like C/C++
compiler. Rather it converts the source code into an intermediate code called as
the byte code and this byte code is
further translated to machine dependent form by another
layer of software called as JVM(Java Virtual Machine).
17
Robust
• It uses strong memory management.
• Java provides automatic garbage collection which runs on the Java
Virtual Machine to get rid of objects which are not being used by a
Java application anymore.
• There are exception handling and the type checking mechanism in
Java. All these points make Java robust.
• Java is portable because it facilitates you to carry the Java
bytecode to any platform. It doesn't require any implementation.
18
Portable
Interpreted and High Performance
• Java enables the creation of cross-platform programs by compiling
into an intermediate representation called Java bytecode.
• This code can be executed on any system that implements the Java
Virtual Machine.
• Most previous attempts at cross-platform solutions have done so at
the expense of performance
19
Multithreaded
• Java supports multithreaded programming, which allows you to
write programs that do many things simultaneously.
Example:
• Railway ticket reservation system where multiple customers
accessing the server. Multiple account holders accessing their
accounts simultaneously on the server. When you insert a ATM
card.
20
Distributed
• Java is distributed because it facilitates users to create distributed
applications in Java.
• RMI is used for creating distributed applications.
• This feature of Java makes us able to access files by calling the
methods from any machine on the internet.
• Java supports dynamic compilation and automatic memory
management (garbage collection).
21
Dynamic
Simple program
class Simple
{
public static void main(String args[])
{
System.out.println("Java World");
}
}
22
Simple program
class Simple
{
public static void main(String args[])
{
System.out.println("Java World");
}
}
23
• Write a java program to convert centigrade into Fahrenheit.
• Write a java program to display student details of the following
name, Register no, date of birth age and Nationality.
• Write a java program to compute simple interest.
• Write a java program Fahrenheit to Celsius
• Write a java program Find Odd or Even:
• Write a java program to compute Fibonacci Series:
24
Questions
1. Java object oriented programming concepts is/are
Select one:
a. Inheritance
b. polymorphism
c. All of the above.
d. Encapsulation
2. Polymorphism types in Java is/are
Select one:
a. None
b. Compile time
c. Run time
d. Both
3. JVM is an interpreter for
Select one:
a. Java
b. javac
c. Bytecode
d. JRE
25
4.Java was known as
a. jdk
b. Apple
c. oak
d. Java only
5.Java does not support ? Select one:
a. compile time polymorphism
b. Multiple inheritance for classes
c. multiple inheritance of interfaces
d. Inheritance
6. Which component is used to compile, debug and execute java program? Select one:
a. JIT
b. JDK
c. JRE
d. JVM
7. What is use of interpreter? Select one:
26
OOPs Concepts
• Object-Oriented Programming is a methodology to design a
program using classes and objects. It simplifies software
development and maintenance by providing some concepts.
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
27
Class
Class is a collection data members and Methods
A class can also be defined as a blueprint from which you can create an individual object.
Example:
class classname {
type instance variable 1;
type instance variable 2;
.
.
type instance variable n;
type methodname 1 (parameter list) {
// body of method
}
type methodname 2 (parameter list) {
// body of method
}
type methodnamen (parameter list) {
// body of method
}
28
objects
• Any entity that has state and behavior is known as an object
• Single Instance of class.
• Objects are always called instances of a class which are created from a
class in java.
Example
Public class Mybook {
int x=10;
Public static void main (String args []) {
Mybook Myobj= new Mybook ();
System.out.println(MyObj.x);
}
}
29
ABSTRACTION
• Abstraction is the process of taking only a set of essential
characteristics from something.
• Hiding internal details and showing functionality is known as
abstraction.
• We can say that the main purpose of abstraction is data hiding
Abstract class animal {
//abstract method
public abstract void sound ( ) ;
}
30
INHERITANCE
• Inheritance is the process in which derived class acquire all the
properties from the base class.
• It inherits the properties from the base class by using extends keyword
• It provides code reusability.
• It is used to achieve runtime polymorphism.
• Types
1. Single level
2. Multilevel
3. Hierarchical level
4. Hybrid inheritance
31
Singe Inheritance
• In this one class i.e., the derived class inherits properties from its
parental class.
• Class A is the base or parental class and class b is the derived
class.
Class a {
…
}
Class b extends class a {
…
}
32
Multilevel Inheritance
• This one class is derived from another class which is also derived from
another class i.e., this class has more than one parental class, hence it is
called multilevel inheritance
Class a {
….
}
Class b extends class a {
….
}
Class c extends class b {
…
}
33
Hierarchical level
• In this one parental class has two or more derived classes or we can say
that two or more child classes have one parental class.
Class a {
….
}
Class b extends class a {
….
}
Class c extends class a {
…
}
34
Hybrid Inheritance
• This is the combination of multiple and multilevel inheritances and
in java, multiple inheritances are not supported as it leads to
ambiguity and this type of inheritance can only be achieved
through interfaces.
35
POLYMORPHISM
• Polymorphism refers to many forms, or it is a process that
performs a single action in different ways.
TYPES
1. COMPILE TIME  Method Overloading
2. RUN TIME  Method Overriding
• One of the examples of Compile time polymorphism is that when
we overload a static method in java.
• Run time polymorphism also called a dynamic method dispatch is
a method in which a call to an overridden method is resolved at
run time rather than compile time
36
Method Overloading
A Class contain two or more methods may have the
same name but different parameter List is called Method
Overloading
void func()
{
Statement(s)
}
void func(int a)
{
Statement(s)
}
float func(double a)
{
Statement(s)
}
float func(int a, float b)
{
Statement(s)
}
37
DATA TYPES
• Data Types in Java
• Data types specify the different sizes and values that can
be stored in the variable. There are two types of data types
in Java:
• Primitive data types: The primitive data types include
boolean, char, byte, short, int, long, float and double.
• Non-primitive data types: The non-primitive data types
include Classes, Interfaces, and Arrays.
38
39
Data Type Size Description
byte 1 byte Stores whole numbers from -128 to 127
short 2 bytes Stores whole numbers from -32,768 to 32,767
int 4 bytes Stores whole numbers from -2,147,483,648 to 2,147,483,647
long 8 bytes Stores whole numbers from -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
float 4 bytes Stores fractional numbers. Sufficient for storing 6 to 7 decimal
digits
double 8 bytes Stores fractional numbers. Sufficient for storing 15 decimal digits
boolean 1 bit Stores true or false values
char 2 bytes Stores a single character/letter or ASCII values
40
41
Example
• int myNum = 5; // Integer (whole number)
• float myFloatNum = 5.99f; // Floating point number
• char myLetter = 'D'; // Character
• boolean myBool = true;
• String name=“Raja”;
42

More Related Content

Similar to Java ppt-class_Introduction_class_Objects.ppt (20)

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
 
1.INTRODUCTION TO JAVA_2022 MB.ppt .
1.INTRODUCTION TO JAVA_2022 MB.ppt      .1.INTRODUCTION TO JAVA_2022 MB.ppt      .
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
Java programming Introduction | Java basic architecture
Java programming Introduction | Java basic architectureJava programming Introduction | Java basic architecture
Java programming Introduction | Java basic architecture
shaswinayyan
 
Java Basics in Mule
Java Basics in MuleJava Basics in Mule
Java Basics in Mule
Rajkattamuri
 
Java Basics
Java BasicsJava Basics
Java Basics
Khan625
 
Java in Mule
Java in MuleJava in Mule
Java in Mule
Shahid Shaik
 
Chapter-1 Introduction.pptx
Chapter-1 Introduction.pptxChapter-1 Introduction.pptx
Chapter-1 Introduction.pptx
SumanBhandari40
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
DeepanshuMidha5140
 
Java1
Java1Java1
Java1
computertuitions
 
Java
Java Java
Java
computertuitions
 
Java-Unit-I.ppt
Java-Unit-I.pptJava-Unit-I.ppt
Java-Unit-I.ppt
RameswarGprec
 
Java session2
Java session2Java session2
Java session2
Jigarthacker
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf
DeepakChaudhriAmbali
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
00 intro to java
00 intro to java00 intro to java
00 intro to java
Deia Abdullah
 
Java
JavaJava
Java
seenak
 
Ch2
Ch2Ch2
Ch2
Uğurcan Uzer
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Phaniu
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
javeed_mhd
 
java language features and explanation with ex
java language features and explanation with exjava language features and explanation with ex
java language features and explanation with ex
SATYA136395
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
 
1.INTRODUCTION TO JAVA_2022 MB.ppt .
1.INTRODUCTION TO JAVA_2022 MB.ppt      .1.INTRODUCTION TO JAVA_2022 MB.ppt      .
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
Java programming Introduction | Java basic architecture
Java programming Introduction | Java basic architectureJava programming Introduction | Java basic architecture
Java programming Introduction | Java basic architecture
shaswinayyan
 
Java Basics in Mule
Java Basics in MuleJava Basics in Mule
Java Basics in Mule
Rajkattamuri
 
Java Basics
Java BasicsJava Basics
Java Basics
Khan625
 
Chapter-1 Introduction.pptx
Chapter-1 Introduction.pptxChapter-1 Introduction.pptx
Chapter-1 Introduction.pptx
SumanBhandari40
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf
DeepakChaudhriAmbali
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Phaniu
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
javeed_mhd
 
java language features and explanation with ex
java language features and explanation with exjava language features and explanation with ex
java language features and explanation with ex
SATYA136395
 

More from VGaneshKarthikeyan (20)

1.3 Basic coding skills_fundamentals .ppt
1.3 Basic coding skills_fundamentals .ppt1.3 Basic coding skills_fundamentals .ppt
1.3 Basic coding skills_fundamentals .ppt
VGaneshKarthikeyan
 
5_Model for Predictions_Machine_Learning.ppt
5_Model for Predictions_Machine_Learning.ppt5_Model for Predictions_Machine_Learning.ppt
5_Model for Predictions_Machine_Learning.ppt
VGaneshKarthikeyan
 
2_Errors in Experimental Observations_ML.ppt
2_Errors in Experimental Observations_ML.ppt2_Errors in Experimental Observations_ML.ppt
2_Errors in Experimental Observations_ML.ppt
VGaneshKarthikeyan
 
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdfFINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
VGaneshKarthikeyan
 
FINAL_DAY10_INTERFACES_roles and benefits.pptx
FINAL_DAY10_INTERFACES_roles and benefits.pptxFINAL_DAY10_INTERFACES_roles and benefits.pptx
FINAL_DAY10_INTERFACES_roles and benefits.pptx
VGaneshKarthikeyan
 
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptxFINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
VGaneshKarthikeyan
 
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptxFINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
VGaneshKarthikeyan
 
JAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.pptJAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.ppt
VGaneshKarthikeyan
 
INT104 DBMS - Introduction_Atomicity.ppt
INT104 DBMS - Introduction_Atomicity.pptINT104 DBMS - Introduction_Atomicity.ppt
INT104 DBMS - Introduction_Atomicity.ppt
VGaneshKarthikeyan
 
6. Implementation of classes_and_its_advantages.pdf
6. Implementation of classes_and_its_advantages.pdf6. Implementation of classes_and_its_advantages.pdf
6. Implementation of classes_and_its_advantages.pdf
VGaneshKarthikeyan
 
Operators_in_C++_advantages_applications.ppt
Operators_in_C++_advantages_applications.pptOperators_in_C++_advantages_applications.ppt
Operators_in_C++_advantages_applications.ppt
VGaneshKarthikeyan
 
1_Standard error Experimental Data_ML.ppt
1_Standard error Experimental Data_ML.ppt1_Standard error Experimental Data_ML.ppt
1_Standard error Experimental Data_ML.ppt
VGaneshKarthikeyan
 
Unit III Part I_Opertaor_Overloading.pptx
Unit III Part I_Opertaor_Overloading.pptxUnit III Part I_Opertaor_Overloading.pptx
Unit III Part I_Opertaor_Overloading.pptx
VGaneshKarthikeyan
 
Linear_discriminat_analysis_in_Machine_Learning.pptx
Linear_discriminat_analysis_in_Machine_Learning.pptxLinear_discriminat_analysis_in_Machine_Learning.pptx
Linear_discriminat_analysis_in_Machine_Learning.pptx
VGaneshKarthikeyan
 
K-Mean clustering_Introduction_Applications.pptx
K-Mean clustering_Introduction_Applications.pptxK-Mean clustering_Introduction_Applications.pptx
K-Mean clustering_Introduction_Applications.pptx
VGaneshKarthikeyan
 
Numpy_defintion_description_usage_examples.pptx
Numpy_defintion_description_usage_examples.pptxNumpy_defintion_description_usage_examples.pptx
Numpy_defintion_description_usage_examples.pptx
VGaneshKarthikeyan
 
Refined_Lecture-14-Linear Algebra-Review.ppt
Refined_Lecture-14-Linear Algebra-Review.pptRefined_Lecture-14-Linear Algebra-Review.ppt
Refined_Lecture-14-Linear Algebra-Review.ppt
VGaneshKarthikeyan
 
randomwalks_states_figures_events_happenings.ppt
randomwalks_states_figures_events_happenings.pptrandomwalks_states_figures_events_happenings.ppt
randomwalks_states_figures_events_happenings.ppt
VGaneshKarthikeyan
 
stochasticmodellinganditsapplications.ppt
stochasticmodellinganditsapplications.pptstochasticmodellinganditsapplications.ppt
stochasticmodellinganditsapplications.ppt
VGaneshKarthikeyan
 
1.10 Tuples_sets_usage_applications_advantages.pptx
1.10 Tuples_sets_usage_applications_advantages.pptx1.10 Tuples_sets_usage_applications_advantages.pptx
1.10 Tuples_sets_usage_applications_advantages.pptx
VGaneshKarthikeyan
 
1.3 Basic coding skills_fundamentals .ppt
1.3 Basic coding skills_fundamentals .ppt1.3 Basic coding skills_fundamentals .ppt
1.3 Basic coding skills_fundamentals .ppt
VGaneshKarthikeyan
 
5_Model for Predictions_Machine_Learning.ppt
5_Model for Predictions_Machine_Learning.ppt5_Model for Predictions_Machine_Learning.ppt
5_Model for Predictions_Machine_Learning.ppt
VGaneshKarthikeyan
 
2_Errors in Experimental Observations_ML.ppt
2_Errors in Experimental Observations_ML.ppt2_Errors in Experimental Observations_ML.ppt
2_Errors in Experimental Observations_ML.ppt
VGaneshKarthikeyan
 
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdfFINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
FINAL_DAY11_INTERFACES_Roles_and_Responsibility.pdf
VGaneshKarthikeyan
 
FINAL_DAY10_INTERFACES_roles and benefits.pptx
FINAL_DAY10_INTERFACES_roles and benefits.pptxFINAL_DAY10_INTERFACES_roles and benefits.pptx
FINAL_DAY10_INTERFACES_roles and benefits.pptx
VGaneshKarthikeyan
 
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptxFINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
FINAL_DAY8_VISIBILITY_LABELS_Roles and.pptx
VGaneshKarthikeyan
 
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptxFINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
FINAL_DAY9_METHOD_OVERRIDING_Role and benefits .pptx
VGaneshKarthikeyan
 
JAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.pptJAVA_BASICS_Data_abstraction_encapsulation.ppt
JAVA_BASICS_Data_abstraction_encapsulation.ppt
VGaneshKarthikeyan
 
INT104 DBMS - Introduction_Atomicity.ppt
INT104 DBMS - Introduction_Atomicity.pptINT104 DBMS - Introduction_Atomicity.ppt
INT104 DBMS - Introduction_Atomicity.ppt
VGaneshKarthikeyan
 
6. Implementation of classes_and_its_advantages.pdf
6. Implementation of classes_and_its_advantages.pdf6. Implementation of classes_and_its_advantages.pdf
6. Implementation of classes_and_its_advantages.pdf
VGaneshKarthikeyan
 
Operators_in_C++_advantages_applications.ppt
Operators_in_C++_advantages_applications.pptOperators_in_C++_advantages_applications.ppt
Operators_in_C++_advantages_applications.ppt
VGaneshKarthikeyan
 
1_Standard error Experimental Data_ML.ppt
1_Standard error Experimental Data_ML.ppt1_Standard error Experimental Data_ML.ppt
1_Standard error Experimental Data_ML.ppt
VGaneshKarthikeyan
 
Unit III Part I_Opertaor_Overloading.pptx
Unit III Part I_Opertaor_Overloading.pptxUnit III Part I_Opertaor_Overloading.pptx
Unit III Part I_Opertaor_Overloading.pptx
VGaneshKarthikeyan
 
Linear_discriminat_analysis_in_Machine_Learning.pptx
Linear_discriminat_analysis_in_Machine_Learning.pptxLinear_discriminat_analysis_in_Machine_Learning.pptx
Linear_discriminat_analysis_in_Machine_Learning.pptx
VGaneshKarthikeyan
 
K-Mean clustering_Introduction_Applications.pptx
K-Mean clustering_Introduction_Applications.pptxK-Mean clustering_Introduction_Applications.pptx
K-Mean clustering_Introduction_Applications.pptx
VGaneshKarthikeyan
 
Numpy_defintion_description_usage_examples.pptx
Numpy_defintion_description_usage_examples.pptxNumpy_defintion_description_usage_examples.pptx
Numpy_defintion_description_usage_examples.pptx
VGaneshKarthikeyan
 
Refined_Lecture-14-Linear Algebra-Review.ppt
Refined_Lecture-14-Linear Algebra-Review.pptRefined_Lecture-14-Linear Algebra-Review.ppt
Refined_Lecture-14-Linear Algebra-Review.ppt
VGaneshKarthikeyan
 
randomwalks_states_figures_events_happenings.ppt
randomwalks_states_figures_events_happenings.pptrandomwalks_states_figures_events_happenings.ppt
randomwalks_states_figures_events_happenings.ppt
VGaneshKarthikeyan
 
stochasticmodellinganditsapplications.ppt
stochasticmodellinganditsapplications.pptstochasticmodellinganditsapplications.ppt
stochasticmodellinganditsapplications.ppt
VGaneshKarthikeyan
 
1.10 Tuples_sets_usage_applications_advantages.pptx
1.10 Tuples_sets_usage_applications_advantages.pptx1.10 Tuples_sets_usage_applications_advantages.pptx
1.10 Tuples_sets_usage_applications_advantages.pptx
VGaneshKarthikeyan
 
Ad

Recently uploaded (20)

Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
BITS Goa Quiz Club
 
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
BITS Goa Quiz Club
 
Cybersecurity_in_Education_System_Advanced.pptx
Cybersecurity_in_Education_System_Advanced.pptxCybersecurity_in_Education_System_Advanced.pptx
Cybersecurity_in_Education_System_Advanced.pptx
safamanz001safa
 
Past simple, present perfect or present perfect continuous
Past simple, present perfect or present perfect continuousPast simple, present perfect or present perfect continuous
Past simple, present perfect or present perfect continuous
trucn4
 
MagicOS 9 PowerPoint Inspired By AR 4789
MagicOS 9 PowerPoint Inspired By AR 4789MagicOS 9 PowerPoint Inspired By AR 4789
MagicOS 9 PowerPoint Inspired By AR 4789
elliotbuckbyfuncicha
 
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
BITS Goa Quiz Club
 
Reasons why dancing iw my favorite hobby favorite hobby (2).pptx
Reasons why dancing iw my favorite hobby favorite hobby (2).pptxReasons why dancing iw my favorite hobby favorite hobby (2).pptx
Reasons why dancing iw my favorite hobby favorite hobby (2).pptx
memi27
 
Reasons why basketball is my favorite hobby?
Reasons why basketball is my favorite hobby?Reasons why basketball is my favorite hobby?
Reasons why basketball is my favorite hobby?
memi27
 
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPTWHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
Optimistic18
 
Bouba and Zaza Respect Water Pitch Bible
Bouba and Zaza Respect Water Pitch BibleBouba and Zaza Respect Water Pitch Bible
Bouba and Zaza Respect Water Pitch Bible
AdelaHurtado
 
Season 11 _ EP 03 - The General Quiz.pptx
Season 11 _ EP 03 - The General Quiz.pptxSeason 11 _ EP 03 - The General Quiz.pptx
Season 11 _ EP 03 - The General Quiz.pptx
Quiz Club, Indian Institute of Technology, Patna
 
Final-TheGuide_Analysed-46430_Final-RR.docx
Final-TheGuide_Analysed-46430_Final-RR.docxFinal-TheGuide_Analysed-46430_Final-RR.docx
Final-TheGuide_Analysed-46430_Final-RR.docx
EarthSoft Foundation of Guidance - EFG
 
最新版美国天普大学毕业证(Temple毕业证书)原版定制
最新版美国天普大学毕业证(Temple毕业证书)原版定制最新版美国天普大学毕业证(Temple毕业证书)原版定制
最新版美国天普大学毕业证(Temple毕业证书)原版定制
Taqyea
 
Season_11_EP05 - The Last Minute Quiz.pptx.pptx
Season_11_EP05 - The Last Minute Quiz.pptx.pptxSeason_11_EP05 - The Last Minute Quiz.pptx.pptx
Season_11_EP05 - The Last Minute Quiz.pptx.pptx
Quiz Club, Indian Institute of Technology, Patna
 
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
BITS Goa Quiz Club
 
ppt on adventure of toto(class 9) english
ppt on adventure of toto(class 9) englishppt on adventure of toto(class 9) english
ppt on adventure of toto(class 9) english
bhoomigoel654321
 
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
BITS Goa Quiz Club
 
Baby oil m123131aking tutorial (natural ingresients.pptx
Baby oil m123131aking tutorial (natural ingresients.pptxBaby oil m123131aking tutorial (natural ingresients.pptx
Baby oil m123131aking tutorial (natural ingresients.pptx
RanitMal
 
feliz dia de san patricio celebrarlo como actividad
feliz dia de san patricio celebrarlo como actividadfeliz dia de san patricio celebrarlo como actividad
feliz dia de san patricio celebrarlo como actividad
info2025gloriamanzan
 
Reasons why dancing is my favorite hobby
Reasons why dancing is my favorite hobbyReasons why dancing is my favorite hobby
Reasons why dancing is my favorite hobby
memi27
 
Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
Ganimatoonics Finals || QM: Agastya and Nikhil || Quark'25 || BITS Pilani, KK...
BITS Goa Quiz Club
 
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
Internet Quiz - Finals || Aditya Shiva Sharma, Druva and Haaziq || Midnight Q...
BITS Goa Quiz Club
 
Cybersecurity_in_Education_System_Advanced.pptx
Cybersecurity_in_Education_System_Advanced.pptxCybersecurity_in_Education_System_Advanced.pptx
Cybersecurity_in_Education_System_Advanced.pptx
safamanz001safa
 
Past simple, present perfect or present perfect continuous
Past simple, present perfect or present perfect continuousPast simple, present perfect or present perfect continuous
Past simple, present perfect or present perfect continuous
trucn4
 
MagicOS 9 PowerPoint Inspired By AR 4789
MagicOS 9 PowerPoint Inspired By AR 4789MagicOS 9 PowerPoint Inspired By AR 4789
MagicOS 9 PowerPoint Inspired By AR 4789
elliotbuckbyfuncicha
 
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
The Conspiracies Quiz || QM: Vagarth Dvivedi || Waves 2024 QuizFest || Midnig...
BITS Goa Quiz Club
 
Reasons why dancing iw my favorite hobby favorite hobby (2).pptx
Reasons why dancing iw my favorite hobby favorite hobby (2).pptxReasons why dancing iw my favorite hobby favorite hobby (2).pptx
Reasons why dancing iw my favorite hobby favorite hobby (2).pptx
memi27
 
Reasons why basketball is my favorite hobby?
Reasons why basketball is my favorite hobby?Reasons why basketball is my favorite hobby?
Reasons why basketball is my favorite hobby?
memi27
 
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPTWHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
WHO KILLED ALASKA? #28: Bobby Time - "THE HUNT FOR THE HAND" TRANSCRIPT
Optimistic18
 
Bouba and Zaza Respect Water Pitch Bible
Bouba and Zaza Respect Water Pitch BibleBouba and Zaza Respect Water Pitch Bible
Bouba and Zaza Respect Water Pitch Bible
AdelaHurtado
 
最新版美国天普大学毕业证(Temple毕业证书)原版定制
最新版美国天普大学毕业证(Temple毕业证书)原版定制最新版美国天普大学毕业证(Temple毕业证书)原版定制
最新版美国天普大学毕业证(Temple毕业证书)原版定制
Taqyea
 
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
Ganimatoonics Prelims || QM: Agastya Sanyal and Nikhil Vinay || Quark'25 || B...
BITS Goa Quiz Club
 
ppt on adventure of toto(class 9) english
ppt on adventure of toto(class 9) englishppt on adventure of toto(class 9) english
ppt on adventure of toto(class 9) english
bhoomigoel654321
 
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
Lit Quiz Prelims || QM: Shivansh Verma, Dhruba Chatterjee & Suhani Timbadia |...
BITS Goa Quiz Club
 
Baby oil m123131aking tutorial (natural ingresients.pptx
Baby oil m123131aking tutorial (natural ingresients.pptxBaby oil m123131aking tutorial (natural ingresients.pptx
Baby oil m123131aking tutorial (natural ingresients.pptx
RanitMal
 
feliz dia de san patricio celebrarlo como actividad
feliz dia de san patricio celebrarlo como actividadfeliz dia de san patricio celebrarlo como actividad
feliz dia de san patricio celebrarlo como actividad
info2025gloriamanzan
 
Reasons why dancing is my favorite hobby
Reasons why dancing is my favorite hobbyReasons why dancing is my favorite hobby
Reasons why dancing is my favorite hobby
memi27
 
Ad

Java ppt-class_Introduction_class_Objects.ppt

  • 1. Course code: CSE208 - JAVA PROGRAMMING 1
  • 2. What is java? • Java is a general purpose, Object oriented programming Language • Java is platform independent: the same program can run on any correctly implemented Java system • Java is object-oriented: • Structured in terms of classes, which group data with operations on that data • Can construct new classes by extending existing ones • Java designed as • A core language plus • A rich collection of commonly available packages • Java can be embedded in Web pages 2
  • 3. Reasons for using java • Built-in support for multi-threading, socket communication, and memory management (automatic garbage collection). • Object Oriented (OO). • Better portability than other languages across operating systems. • Supports Web based applications (Applet, Servlet, and JSP), distributed applications (sockets, RMI, EJB etc) and network protocols (HTTP, JRMP etc) with the help of extensive standardized APIs (Application Programming Interfaces). 3
  • 4. Java and its Evolution 4  Programming languages such as Cobol, Fortran do not have structural principles. They use the Goto statement to control the flow of the program.  Therefore, ’C’ was invented in 1970, to replace the assembly language and to create a structured, effective and high-level language  C++ came with object-oriented programming features. C++ is the extension of C language which has been used extensively. It is a powerful modern language that includes the power and simplicity of C and the characteristics of OOP.
  • 5. Java History • Java is a general purpose, Object oriented programming Language developed by Sun Microsystems of USA in 1991. Originally called Oak by James Gosling. • 1990 – Sun Microsystems decided to develop special software for consumer electronic devices headed by James Gosling. • 1991 – Using C++ the team announced a new language named Oak. • 1992 – The Green project team by Sun, shown new language to control home appliances using hand held device with tiny touch-sensitive screen. • 1993 - The www appeared on the internet and transformed the text based internet into graphical rich environment using Web Applets. • 1994 – Team developed a web browser called “HotJava” for web Applets. • 1995 – “Oak” was renamed “Java” due to some legal snags. Java is just a name. Netscape and Microsoft supports to Java. • 1996 – Java established itself as a leader for internet & general purpose programming. Java founds its home. 5
  • 6. JAVA SE VERSION RELEASE DATE JDK 1.0 Jan-96 JDK 1.1 Feb-97 J2SE 1.2 Dec-98 J2SE 1.3 May-2000 J2SE 1.4 Feb-2002 J2SE 5.0 Sep-2004 Java SE 6 Dec-2006 Java SE 7 Jul-2011 Java SE 8 Mar-2014 Java SE 9 September, 21st 2017 Java SE 10 March, 20th 2018 Java SE 11 September, 25th 2018 Java SE 12 March, 19th 2019 Java SE 13 September, 17th 2019 Java SE 14 March, 17th 2020 Java SE 15 September, 15th 2020 Java SE 16 March, 16th 2021 Java SE 17 September, 14th 2021 Java SE 18 March, 22nd 2022 Java SE 19 September, 20th 2022 Java SE 20 March, 21st 2023 6 Java Versions
  • 7. 7 Procedural Oriented Programming Object-Oriented Programming In procedural programming, the program is divided into small parts called functions. In object-oriented programming, the program is divided into small parts called objects. Procedural programming follows a top-down approach. Object-oriented programming follows a bottom-up approach. There is no access specifier in procedural programming. Object-oriented programming has access specifiers like private, public, protected, etc. Procedural programming does not have any proper way of hiding data so it is less secure. Object-oriented programming provides data hiding so it is more secure. In procedural programming, overloading is not possible. Overloading is possible in object-oriented programming. In procedural programming, there is no concept of data hiding and inheritance. In object-oriented programming, the concept of data hiding and inheritance is used. In procedural programming, the function is more important than the data. In object-oriented programming, data is more important than function. Procedural programming uses the concept of procedure abstraction. Object-oriented programming uses the concept of data abstraction. Code reusability absent in procedural programming, Code reusability present in object-oriented programming.
  • 8. Differences between C++ and Java 8 Sl. no COMPARISON PARAMETER C++ JAVA 1 Developed / Founded by C++ was developed by Bjarne Stroustrup at Bell Labs in 1979. It was developed as an extension of the C language. Java was developed by James Gosling at Sun Microsystems. Now, it is owned by Oracle. 2 Programming model It has support for both procedural programming and object-oriented programming. Java has support only for object-oriented programming models. 3 Platform dependence C++ is platform dependent. It is based on the concept of Write Once Compile Anywhere. Java is platform-independent. It is based on the concept of Write Once Run Anywhere. 4 Features supported C++ supports features like operator overloading, Goto statements, structures, pointers, unions, etc. Java does not support features like operator overloading, Goto statements, structures, pointers, unions, etc. 5 Compilation and Interpretation C ++ is only compiled and cannot be interpreted. Java can be both compiled and interpreted. 6 Library and Code reusability support C++ has very limited libraries with low-level functionalities. C++ allows direct calls to native system libraries. Java, on the other hand, has more diverse libraries with a lot of support for code reusability. In Java, only calls through the Java Native Interface and recently Java Native Access are allowed. 7 Memory Management In C++, memory management is manual. In Java, memory management is System controlled. 9 Global Scope In C++, both global and namespace scopes are supported. Java has no support for global scope.
  • 9. Java Environment • Java Environment includes large number of development tools. • The development tools are part of the system known as Java Development Kit ( JDK ). • JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment which is used to develop java applications and applets. It physically exists. It contains JRE + development tools. 9
  • 10. Java Runtime Environment ( JRE ) • The Java Runtime Environment ( JRE ) facilitates the execution of programs developed in java. It comprises the following: • Java Virtual Machine ( JVM ) : • Java Virtual Machine (JVM) is an engine that provides a runtime environment to drive the Java Code or applications. It converts Java bytecode into machine language. This machine is called Java Virtual Machine and it exists only inside the computer memory. • Compiling source code into bytecode ( machine readable code ) using javac compiler. • Executing the bytecode ( machine-readable code ) to human- understandable code using a Java interpreter 10
  • 11. Java’s Magic: The Byte Code  Allows Java to solve both the security and the portability problems is that the output of a Java compiler is not executable code but it is the Bytecode.  Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system, which is called the Java Virtual Machine (JVM).  JVM is an interpreter for bytecode. The fact that a Java program is executed by JVM helps solve the major problems associated with downloading programs over the Internet.  Translating a Java program into bytecode helps makes it much easier to run a program in a wide variety of environments. This is because only the JVM needs to be implemented for each platform.
  • 12. Java is Compiled and Interpreted Text Editor Compiler Interpreter Programmer Source Code .java file Byte Code .class file Hardware and Operating System Notepad, emacs, javac java appletviewer Java is both compiled and an interpreted lang. First the java compiler translates source code into the byte code instructions. In the next stage the java interpreter converts the byte code instructions to Machine Code.
  • 13. Java features/Java Buzzwords • Simple • Object-Oriented • Portable • Platform independent • Secured • Robust • Architecture neutral • Interpreted • High Performance • Multithreaded • Distributed • Dynamic 13
  • 14. Simple • Java is very easy to learn, and its syntax is simple, clean and easy to understand. • Java syntax is based on C++ (so easier for programmers to learn it after C++). • Java has removed many complicated and rarely-used features, for example, explicit pointers, operator overloading, etc. • There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java. 14
  • 15. Secure • Secure As compared to C/C++, Java is considered to be much more secure language, as it does not allow a programmer to create pointers. Thus in Java we cannot access any address directly and this makes Java much more reliable and secure as compared to C/C++. • In Java, we can split a program into multiple parts and store these parts on different computers. 15
  • 16. Object-Oriented • Java is an object-oriented programming language. Everything in Java is an object. • Object-oriented means we organize our software as a combination of different types of objects that incorporate both data and behavior. • Basic concepts of OOPs are:  Object  Class  Inheritance  Polymorphism  Abstraction  Encapsulation 16
  • 17. Platform Independent/Architecture Neutral • Java is platform independent because it is different from other languages like C, C++, etc. • Being java independent means, Programme compiled n one machine that can be executed in another machine without any change. • The Java compiler never converts the source code to machine code like C/C++ compiler. Rather it converts the source code into an intermediate code called as the byte code and this byte code is further translated to machine dependent form by another layer of software called as JVM(Java Virtual Machine). 17
  • 18. Robust • It uses strong memory management. • Java provides automatic garbage collection which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore. • There are exception handling and the type checking mechanism in Java. All these points make Java robust. • Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn't require any implementation. 18 Portable
  • 19. Interpreted and High Performance • Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java bytecode. • This code can be executed on any system that implements the Java Virtual Machine. • Most previous attempts at cross-platform solutions have done so at the expense of performance 19
  • 20. Multithreaded • Java supports multithreaded programming, which allows you to write programs that do many things simultaneously. Example: • Railway ticket reservation system where multiple customers accessing the server. Multiple account holders accessing their accounts simultaneously on the server. When you insert a ATM card. 20
  • 21. Distributed • Java is distributed because it facilitates users to create distributed applications in Java. • RMI is used for creating distributed applications. • This feature of Java makes us able to access files by calling the methods from any machine on the internet. • Java supports dynamic compilation and automatic memory management (garbage collection). 21 Dynamic
  • 22. Simple program class Simple { public static void main(String args[]) { System.out.println("Java World"); } } 22
  • 23. Simple program class Simple { public static void main(String args[]) { System.out.println("Java World"); } } 23
  • 24. • Write a java program to convert centigrade into Fahrenheit. • Write a java program to display student details of the following name, Register no, date of birth age and Nationality. • Write a java program to compute simple interest. • Write a java program Fahrenheit to Celsius • Write a java program Find Odd or Even: • Write a java program to compute Fibonacci Series: 24
  • 25. Questions 1. Java object oriented programming concepts is/are Select one: a. Inheritance b. polymorphism c. All of the above. d. Encapsulation 2. Polymorphism types in Java is/are Select one: a. None b. Compile time c. Run time d. Both 3. JVM is an interpreter for Select one: a. Java b. javac c. Bytecode d. JRE 25
  • 26. 4.Java was known as a. jdk b. Apple c. oak d. Java only 5.Java does not support ? Select one: a. compile time polymorphism b. Multiple inheritance for classes c. multiple inheritance of interfaces d. Inheritance 6. Which component is used to compile, debug and execute java program? Select one: a. JIT b. JDK c. JRE d. JVM 7. What is use of interpreter? Select one: 26
  • 27. OOPs Concepts • Object-Oriented Programming is a methodology to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts. • Object • Class • Inheritance • Polymorphism • Abstraction • Encapsulation 27
  • 28. Class Class is a collection data members and Methods A class can also be defined as a blueprint from which you can create an individual object. Example: class classname { type instance variable 1; type instance variable 2; . . type instance variable n; type methodname 1 (parameter list) { // body of method } type methodname 2 (parameter list) { // body of method } type methodnamen (parameter list) { // body of method } 28
  • 29. objects • Any entity that has state and behavior is known as an object • Single Instance of class. • Objects are always called instances of a class which are created from a class in java. Example Public class Mybook { int x=10; Public static void main (String args []) { Mybook Myobj= new Mybook (); System.out.println(MyObj.x); } } 29
  • 30. ABSTRACTION • Abstraction is the process of taking only a set of essential characteristics from something. • Hiding internal details and showing functionality is known as abstraction. • We can say that the main purpose of abstraction is data hiding Abstract class animal { //abstract method public abstract void sound ( ) ; } 30
  • 31. INHERITANCE • Inheritance is the process in which derived class acquire all the properties from the base class. • It inherits the properties from the base class by using extends keyword • It provides code reusability. • It is used to achieve runtime polymorphism. • Types 1. Single level 2. Multilevel 3. Hierarchical level 4. Hybrid inheritance 31
  • 32. Singe Inheritance • In this one class i.e., the derived class inherits properties from its parental class. • Class A is the base or parental class and class b is the derived class. Class a { … } Class b extends class a { … } 32
  • 33. Multilevel Inheritance • This one class is derived from another class which is also derived from another class i.e., this class has more than one parental class, hence it is called multilevel inheritance Class a { …. } Class b extends class a { …. } Class c extends class b { … } 33
  • 34. Hierarchical level • In this one parental class has two or more derived classes or we can say that two or more child classes have one parental class. Class a { …. } Class b extends class a { …. } Class c extends class a { … } 34
  • 35. Hybrid Inheritance • This is the combination of multiple and multilevel inheritances and in java, multiple inheritances are not supported as it leads to ambiguity and this type of inheritance can only be achieved through interfaces. 35
  • 36. POLYMORPHISM • Polymorphism refers to many forms, or it is a process that performs a single action in different ways. TYPES 1. COMPILE TIME  Method Overloading 2. RUN TIME  Method Overriding • One of the examples of Compile time polymorphism is that when we overload a static method in java. • Run time polymorphism also called a dynamic method dispatch is a method in which a call to an overridden method is resolved at run time rather than compile time 36
  • 37. Method Overloading A Class contain two or more methods may have the same name but different parameter List is called Method Overloading void func() { Statement(s) } void func(int a) { Statement(s) } float func(double a) { Statement(s) } float func(int a, float b) { Statement(s) } 37
  • 38. DATA TYPES • Data Types in Java • Data types specify the different sizes and values that can be stored in the variable. There are two types of data types in Java: • Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double. • Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays. 38
  • 39. 39
  • 40. Data Type Size Description byte 1 byte Stores whole numbers from -128 to 127 short 2 bytes Stores whole numbers from -32,768 to 32,767 int 4 bytes Stores whole numbers from -2,147,483,648 to 2,147,483,647 long 8 bytes Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 float 4 bytes Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits double 8 bytes Stores fractional numbers. Sufficient for storing 15 decimal digits boolean 1 bit Stores true or false values char 2 bytes Stores a single character/letter or ASCII values 40
  • 41. 41
  • 42. Example • int myNum = 5; // Integer (whole number) • float myFloatNum = 5.99f; // Floating point number • char myLetter = 'D'; // Character • boolean myBool = true; • String name=“Raja”; 42