SlideShare a Scribd company logo
1
Mr. Akaash
akaashhakim@gmail.com
Java: Introduction Basic
Structure, variables Data type,
input & output
2
Why Java is developed.
 Sun Microsystems ins. Develop deferent software for deferent
devices. Even the work of these soft wares is same.
 If they want to run this software on others platform that is not
possible. then They must have to write deferent program. They write
this program in c/C++.
 Then they release that we reduce this effort only if they Develop a
platform independent language. (Means: Program is written on a
platform then it execute on any platform)
 What is platform? Platform is a environment in that the software is
executed. For we example. In our computer the software is only run
because in our computers one software is already executed. This
software is Operating system.
3
Why Java is developed.
 Operating system works as a platform for those programs that we
want to execute.
 Without operating system we can't run any program
 If any program is execute of deferent operating system then we
call it platform independent software
 For this purpose Sun Microsystems Inc. want to develop a java
language
 In earlier java is developed as a solution of an problem.
4
Introduction of JAVA
 Originally created for consumer
electronics (TV, VCR, Freeze, Washing
Machine, Mobile Phone).
 Java - CPU Independent language
 Internet and Web was just emerging, so
Sun turned it into a language of Internet
Programming.
 It allows you to publish a webpage with
Java code in it.
5
History of Java
 Java Language is developed in 1991 in the form of a project.
 Java Programming Language was written by James Gosling along
with two other person 'Mike Sheridan' and 'Patrick Naughton',
while they were working at Sun Microsystems Inc.
 In earlier Sum Microsystems Inc. want to register this language with the
name OAK language. OAK is the name of tree which is placed out side
the office of James Gosling
 Later the project went by the name Green and was finally renamed
Java, from Java coffee
Java developer James Gosling
6
History of Java
 Java was originally designed for interactive television,
but it was too advanced for the digital cable television
industry at the time
 Gosling designed Java with a C/C++-style syntax that
system and application programmers would find familiar
7
History of java
 On January 27, 2010. java Sun
Microsystems Inc. acquired by Oracle
corporation for US$ 7.4 Billon.
8
Java is everywhere
 JAVA resides in mobiles, client machines,
server machines, embedded devices, smart
phones, cloud etc.
 It Shares same basic features of the language
and libraries
 Principle of JAVA: WORA (Write Once, Run
Anywhere)
9
What is Library
 What is library in C/C++?
 We can say that in C/C++ collection of predefined function is
called C Library
 Java Library is a collection of predefined classes. Like a C/C++.
10
Version history of JAVA
11
There were nine primary goals in the
creation of the Java language:

Simple

Object Oriented Programming

Distributed

Interpreted

Robust

Secure
12
Explanation of Feature of JAVA
 Object-Oriented Programming
 Object-oriented programming (OOP) is a programming
language model organized around objects rather than
"actions" and data rather than logic. Historically, a program
has been viewed as a logical procedure that takes input data,
processes it, and produces output data
 Distributed
 Distributed Java Programming with RMI and CORBA. ...
The Java Remote Method Invocation (RMI) mechanism and
the Common Object Request Broker Architecture (CORBA) are
the two most important and widely used distributed object
systems. Each system has its own features and shortcomings.
13
Explanation of Feature of JAVA
 Interpreted
 Java is a compiled programming language, but rather than
compile straight to executable machine code, it compiles to an
intermediate binary form called JVM byte code. The byte
code is then compiled and/or interpreted to run the program.
 Robust
 Java is Robust because it is highly supported language. It is
portable across many Operating systems. Java also has
feature of Automatic memory management and garbage
collection. Strong type checking mechanism of Java also helps
in making Java Robust. Bugs, especially system crashing
bugs, are very rare in Java
14
Explanation of Feature of JAVA
 Secure
 Vulnerabilities in the protection mechanisms provided by the
hardware or operating system which the application relies upon
for its security. Vulnerabilities in native libraries, such as the C
standard library, which may be used to implement the
application and/or runtime
 Portable
 "Java is portable" refers to the SE version. It means that you
can run Java byte code on any hardware that has a compliant
JVM. It doesn't mean that ME is the same as SE is the same
as EE.
15
Explanation of Feature of JAVA
 Multithreaded
 The main purpose of multithreading is to provide
simultaneous execution of two or more parts of a program to
maximum utilize the CPU time. A multithreaded program
contains two or more parts that can run concurrently. ...
RUNNABLE – A thread executing in the Java virtual machine
is in this state.
 Garbage collector
 The garbage collector is a program which runs on the Java
Virtual Machine which gets rid of objects which are not being
used by a Java application anymore. It is a form of automatic
memory management
16
How to Compile Java Program
When we compile
.Java file it create
.class file
C/C++ compilers convert C/C++ code
in these language which Operating
System Understand… But the JAVA
Compiler convert JAVA code into
Byte code. Operating System can’t
understand this code.
If .java file has 5 classes then JAVA
compiler create five deferent class
files.…
17
Practical of Compile java program
 Firstly we write our java
program in notepad
 Then save this code with
.java extension in bin folder
This bin folderThis bin folder
Saving hello program
with .java extension
Saving hello program
with .java extension
18
Before compile Java program
there is no .class file created
Before compile Java program
there is no .class file created
javac is java compiler
that convert java code to
byte code
javac is java compiler
that convert java code to
byte code
It is java codeIt is java code
After compile
the java code
java compiler
create .class file
After compile
the java code
java compiler
create .class file
19
How Run JAVA Program
For run java program: We install JVM(JAVA Virtual
Machine) we can run our Byte code file with the help
of JVM
JVM is the
Operating System
dependent
program.
This is JVM that execute the
This is .class file
we don’t have to
need write its
extension
Output
20
Java is Compiled and Interpreted
Text Editor Compiler Interpreter
Programmer
Source Code
.java file
Byte Code
.class file
Hardware and
Operating System
Notepad etc. javac java
appletviewer
netscape
21
JAVA Virtual Machine
 JVM is the platform dependent
 The JAVA Virtual Machine provides the
platform-independent way to execute JAVA
code .
 Java Virtual Machine interprets the byte code into
the machine code depending upon the underlying
operating system and hardware combination
22
Total Platform Independence
JAVA COMPILERJAVA COMPILER
JAVA BYTE CODEJAVA BYTE CODE
JAVA INTERPRETERJAVA INTERPRETER
Windows 95 Macintosh Solaris Windows NT
(translator)
(same for all platforms)
(one for each different system)
23
JAVA
 Java is case sensitive language like C/C+
+.
 Java is nearly 100% Object-oriented
language.
 In java it is not possible to make a
function which is not member of any class
(as we do C/C++)
24
NO , Java is 99% oop .
Remaining 1% ?????????
Java 100% OOP???
Reason Primitive Data Types
25
Primitive Data Types Wrapper Classes
1.byte Byte
2.int Integer
3.short Short
4.long Long
5.float Float
6.double Double
7.char Character
8.boolean Boolean
Data Type & Wrapper classes
26
Java Applications
 We can develop two types of Java
programs:
 Stand-alone applications
 Web applications (applets)
27
Java better than C++ ?
 No Typedefs, Defines, or Preprocessor
 No Global Variables
 No Goto statements
 No Pointers
 No Unsafe Structures
 No Multiple Inheritance
 No Operator Overloading
 No Automatic Coercions
 No Fragile Data Types
?
28
Object Oriented Languages -A
Comparison
Feature C++ Objective
C
Ada Java
Encapsulation Yes Yes Yes Yes
Inheritance Yes Yes No Yes
Multiple Inherit. Yes Yes No No
Polymorphism Yes Yes Yes Yes
Binding (Early or Late) Both Both Early Late
Concurrency Poor Poor Difficult Yes
Garbage Collection No Yes No Yes
Genericity Yes No Yes Limited
Class Libraries Yes Yes Limited Yes
29
Basic Structure that almost use in
every java program
Wrapper Class
Main MethodMain Method
Class NameClass Name
Package Name
Body of Main methodBody of Main method
Java Application Save with class name
and .java extension
Java Application Save with class name
and .java extension
Public keyword
specified that main()
function accessible
outside the class
The void specifies means that
main() does not return any
values
Static keyword specified
that main() exists without
any object be defined
The outer class may a public
or default
The inner class may a public
private, protected or default
30
Short Detail of previous Image
 Package:-
 A package have many classes Same type of classes are store in same package.
 Public:-
 The Public keyword specified that main() function accessible outside the class
 Class Name:-
 Class name is user define.
 Class:-
 is Keyword that is optional.
 Static:-
 The Static keyword specified that main() exists without any object be defined
 Void main:-
 Main Method
 String[]:-
 Wrapper Class
 Arg:-
 Arguments
31
Variable in Java
 Variable is used to access data .
 We use variable to store data.
 Variable use for get input from
user.
 Variable used for give output to
user.
32
Variable Declaration
 We declare a variable in java same as in C++.
 Syntax:
Data_type variable_name;
 DataTypes:
 Data_types used for defined type of variable for example you
store (10) integer data. We use int data type.
 Varible_name:
 Variable name is user defined. we can declare variable name
following variable declaration rules
33
Data Types
 Data Types that define which type of value used in program
 There are many data types of java
 Integer Data types
Declaration of integer Variable
Data_types Variablename;
34
Data types
 Floating Data types
Declaration of Floating Variable
Data_types Variablename;
35
Java Output
We use “System.out.println()” for print any
message or result on screen.
System.out.println(“ “)
This is the name of
class that contains
the object out
This is the name of
class that contains
the object out
This is a static
variable that in
system class
This is a static
variable that in
system class
This a method in
object out
Whatever you specify between parenthesis () is
passed to the println( ) method and displayed
36
System.out.println();
System.out.println();
It is used to display message, result and Message+Result.
System is a class that is in java.lang package.
Java.lang package by default import in netbean IDE.
In println() method, “ln” use for new line.
37
System.out.println()
 It used for 3 purpose “Message” , ”Result” and “Message + result”
System.out.println();
Message Result Message + Result
38
System.out.println()/print();
Message
Write Message in Double Quotes(” ”).
Message Display as it we Write in Double Quotes.
39
System.out.println()/print();
Result
Write Result in without Double Quotes(” ”).
What is 15?
Sum of two numbers? OR
Product of two numbers?
40
System.out.println()/print();
Message+Result
Write Message in Double Quotes(” ”).
Write Result in without Double Quotes(” ”).
For concatenation Message and result use plus(+) operator.
Message Result OutputConcate..
.
41
System.out.println()/print();
Message Result OutPutConcate..
.
42
Input in Java
 For input in java
 We import a scanner
 We create a scanner object
 We use methods.
Firstly import Scanner
Create object
Use methods
It is class name
Object name it is user defined
It is Constructer
For Integer Number
More
function
43
More input methods
44
Input program
Output
45
Code of previous Image
package javaapplication6;
import java.util.*;
public class JavaApplication6 {
public static void main(String[] args) {
Scanner obj=new Scanner(System.in);
int num1,num2;
System.out.print("Enter first integer number ::");
num1=obj.nextInt();
System.out.print("Enter Second integer number ::");
num2=obj.nextInt();
System.out.println(num1+"+"+num2+"="+(num1+num2));
}
}

More Related Content

What's hot (20)

JVM
JVMJVM
JVM
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Java Lover
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Saba Ameer
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
sunmitraeducation
 
core java
core javacore java
core java
Roushan Sinha
 
Access Modifier.pptx
Access Modifier.pptxAccess Modifier.pptx
Access Modifier.pptx
Margaret Mary
 
History Of JAVA
History Of JAVAHistory Of JAVA
History Of JAVA
ARSLANAHMED107
 
Features of java
Features of javaFeatures of java
Features of java
Hitesh Kumar
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
Professional Guru
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
OOPS In JAVA.pptx
OOPS In JAVA.pptxOOPS In JAVA.pptx
OOPS In JAVA.pptx
Sachin33417
 
Operators in java
Operators in javaOperators in java
Operators in java
Madishetty Prathibha
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
 
Strings in Java
Strings in Java Strings in Java
Strings in Java
Hitesh-Java
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Java Lover
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Saba Ameer
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
 
Access Modifier.pptx
Access Modifier.pptxAccess Modifier.pptx
Access Modifier.pptx
Margaret Mary
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
OOPS In JAVA.pptx
OOPS In JAVA.pptxOOPS In JAVA.pptx
OOPS In JAVA.pptx
Sachin33417
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
 
Strings in Java
Strings in Java Strings in Java
Strings in Java
Hitesh-Java
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 

Similar to Introduction to Java Programming, Basic Structure, variables Data type, input & output (20)

Sybsc cs sem 3 core java
Sybsc cs sem 3 core javaSybsc cs sem 3 core java
Sybsc cs sem 3 core java
WE-IT TUTORIALS
 
Java Programming Tutorials Basic to Advanced 1
Java Programming Tutorials Basic to Advanced 1Java Programming Tutorials Basic to Advanced 1
Java Programming Tutorials Basic to Advanced 1
JALALUDHEENVK1
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
Harsha Batra
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1
Qualys
 
Java1
Java1Java1
Java1
computertuitions
 
Java
Java Java
Java
computertuitions
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Unit1 JAVA.pptx
Unit1 JAVA.pptxUnit1 JAVA.pptx
Unit1 JAVA.pptx
RahulAnand111531
 
Java Introduction | PDF
Java Introduction |  PDFJava Introduction |  PDF
Java Introduction | PDF
Geekster
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
DeepanshuMidha5140
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
Mukesh Tekwani
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Java2020 programming basics and fundamentals
Java2020 programming basics and fundamentalsJava2020 programming basics and fundamentals
Java2020 programming basics and fundamentals
swecsaleem
 
Java lab lecture 1
Java  lab  lecture 1Java  lab  lecture 1
Java lab lecture 1
vishal choudhary
 
What is Java, JDK, JVM, Introduction to Java.pptx
What is Java, JDK, JVM, Introduction to Java.pptxWhat is Java, JDK, JVM, Introduction to Java.pptx
What is Java, JDK, JVM, Introduction to Java.pptx
kumarsuneel3997
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
DrPreethiD1
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
Madhura Bhalerao
 
Java presentation
Java presentationJava presentation
Java presentation
Karan Sareen
 
Java Evolution-2.pdf
Java Evolution-2.pdfJava Evolution-2.pdf
Java Evolution-2.pdf
kumari36
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
vikasbagra9887
 
Ad

Recently uploaded (20)

THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Ad

Introduction to Java Programming, Basic Structure, variables Data type, input & output

  • 1. 1 Mr. Akaash [email protected] Java: Introduction Basic Structure, variables Data type, input & output
  • 2. 2 Why Java is developed.  Sun Microsystems ins. Develop deferent software for deferent devices. Even the work of these soft wares is same.  If they want to run this software on others platform that is not possible. then They must have to write deferent program. They write this program in c/C++.  Then they release that we reduce this effort only if they Develop a platform independent language. (Means: Program is written on a platform then it execute on any platform)  What is platform? Platform is a environment in that the software is executed. For we example. In our computer the software is only run because in our computers one software is already executed. This software is Operating system.
  • 3. 3 Why Java is developed.  Operating system works as a platform for those programs that we want to execute.  Without operating system we can't run any program  If any program is execute of deferent operating system then we call it platform independent software  For this purpose Sun Microsystems Inc. want to develop a java language  In earlier java is developed as a solution of an problem.
  • 4. 4 Introduction of JAVA  Originally created for consumer electronics (TV, VCR, Freeze, Washing Machine, Mobile Phone).  Java - CPU Independent language  Internet and Web was just emerging, so Sun turned it into a language of Internet Programming.  It allows you to publish a webpage with Java code in it.
  • 5. 5 History of Java  Java Language is developed in 1991 in the form of a project.  Java Programming Language was written by James Gosling along with two other person 'Mike Sheridan' and 'Patrick Naughton', while they were working at Sun Microsystems Inc.  In earlier Sum Microsystems Inc. want to register this language with the name OAK language. OAK is the name of tree which is placed out side the office of James Gosling  Later the project went by the name Green and was finally renamed Java, from Java coffee Java developer James Gosling
  • 6. 6 History of Java  Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time  Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar
  • 7. 7 History of java  On January 27, 2010. java Sun Microsystems Inc. acquired by Oracle corporation for US$ 7.4 Billon.
  • 8. 8 Java is everywhere  JAVA resides in mobiles, client machines, server machines, embedded devices, smart phones, cloud etc.  It Shares same basic features of the language and libraries  Principle of JAVA: WORA (Write Once, Run Anywhere)
  • 9. 9 What is Library  What is library in C/C++?  We can say that in C/C++ collection of predefined function is called C Library  Java Library is a collection of predefined classes. Like a C/C++.
  • 11. 11 There were nine primary goals in the creation of the Java language:  Simple  Object Oriented Programming  Distributed  Interpreted  Robust  Secure
  • 12. 12 Explanation of Feature of JAVA  Object-Oriented Programming  Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data  Distributed  Distributed Java Programming with RMI and CORBA. ... The Java Remote Method Invocation (RMI) mechanism and the Common Object Request Broker Architecture (CORBA) are the two most important and widely used distributed object systems. Each system has its own features and shortcomings.
  • 13. 13 Explanation of Feature of JAVA  Interpreted  Java is a compiled programming language, but rather than compile straight to executable machine code, it compiles to an intermediate binary form called JVM byte code. The byte code is then compiled and/or interpreted to run the program.  Robust  Java is Robust because it is highly supported language. It is portable across many Operating systems. Java also has feature of Automatic memory management and garbage collection. Strong type checking mechanism of Java also helps in making Java Robust. Bugs, especially system crashing bugs, are very rare in Java
  • 14. 14 Explanation of Feature of JAVA  Secure  Vulnerabilities in the protection mechanisms provided by the hardware or operating system which the application relies upon for its security. Vulnerabilities in native libraries, such as the C standard library, which may be used to implement the application and/or runtime  Portable  "Java is portable" refers to the SE version. It means that you can run Java byte code on any hardware that has a compliant JVM. It doesn't mean that ME is the same as SE is the same as EE.
  • 15. 15 Explanation of Feature of JAVA  Multithreaded  The main purpose of multithreading is to provide simultaneous execution of two or more parts of a program to maximum utilize the CPU time. A multithreaded program contains two or more parts that can run concurrently. ... RUNNABLE – A thread executing in the Java virtual machine is in this state.  Garbage collector  The garbage collector is a program which runs on the Java Virtual Machine which gets rid of objects which are not being used by a Java application anymore. It is a form of automatic memory management
  • 16. 16 How to Compile Java Program When we compile .Java file it create .class file C/C++ compilers convert C/C++ code in these language which Operating System Understand… But the JAVA Compiler convert JAVA code into Byte code. Operating System can’t understand this code. If .java file has 5 classes then JAVA compiler create five deferent class files.…
  • 17. 17 Practical of Compile java program  Firstly we write our java program in notepad  Then save this code with .java extension in bin folder This bin folderThis bin folder Saving hello program with .java extension Saving hello program with .java extension
  • 18. 18 Before compile Java program there is no .class file created Before compile Java program there is no .class file created javac is java compiler that convert java code to byte code javac is java compiler that convert java code to byte code It is java codeIt is java code After compile the java code java compiler create .class file After compile the java code java compiler create .class file
  • 19. 19 How Run JAVA Program For run java program: We install JVM(JAVA Virtual Machine) we can run our Byte code file with the help of JVM JVM is the Operating System dependent program. This is JVM that execute the This is .class file we don’t have to need write its extension Output
  • 20. 20 Java is Compiled and Interpreted Text Editor Compiler Interpreter Programmer Source Code .java file Byte Code .class file Hardware and Operating System Notepad etc. javac java appletviewer netscape
  • 21. 21 JAVA Virtual Machine  JVM is the platform dependent  The JAVA Virtual Machine provides the platform-independent way to execute JAVA code .  Java Virtual Machine interprets the byte code into the machine code depending upon the underlying operating system and hardware combination
  • 22. 22 Total Platform Independence JAVA COMPILERJAVA COMPILER JAVA BYTE CODEJAVA BYTE CODE JAVA INTERPRETERJAVA INTERPRETER Windows 95 Macintosh Solaris Windows NT (translator) (same for all platforms) (one for each different system)
  • 23. 23 JAVA  Java is case sensitive language like C/C+ +.  Java is nearly 100% Object-oriented language.  In java it is not possible to make a function which is not member of any class (as we do C/C++)
  • 24. 24 NO , Java is 99% oop . Remaining 1% ????????? Java 100% OOP??? Reason Primitive Data Types
  • 25. 25 Primitive Data Types Wrapper Classes 1.byte Byte 2.int Integer 3.short Short 4.long Long 5.float Float 6.double Double 7.char Character 8.boolean Boolean Data Type & Wrapper classes
  • 26. 26 Java Applications  We can develop two types of Java programs:  Stand-alone applications  Web applications (applets)
  • 27. 27 Java better than C++ ?  No Typedefs, Defines, or Preprocessor  No Global Variables  No Goto statements  No Pointers  No Unsafe Structures  No Multiple Inheritance  No Operator Overloading  No Automatic Coercions  No Fragile Data Types ?
  • 28. 28 Object Oriented Languages -A Comparison Feature C++ Objective C Ada Java Encapsulation Yes Yes Yes Yes Inheritance Yes Yes No Yes Multiple Inherit. Yes Yes No No Polymorphism Yes Yes Yes Yes Binding (Early or Late) Both Both Early Late Concurrency Poor Poor Difficult Yes Garbage Collection No Yes No Yes Genericity Yes No Yes Limited Class Libraries Yes Yes Limited Yes
  • 29. 29 Basic Structure that almost use in every java program Wrapper Class Main MethodMain Method Class NameClass Name Package Name Body of Main methodBody of Main method Java Application Save with class name and .java extension Java Application Save with class name and .java extension Public keyword specified that main() function accessible outside the class The void specifies means that main() does not return any values Static keyword specified that main() exists without any object be defined The outer class may a public or default The inner class may a public private, protected or default
  • 30. 30 Short Detail of previous Image  Package:-  A package have many classes Same type of classes are store in same package.  Public:-  The Public keyword specified that main() function accessible outside the class  Class Name:-  Class name is user define.  Class:-  is Keyword that is optional.  Static:-  The Static keyword specified that main() exists without any object be defined  Void main:-  Main Method  String[]:-  Wrapper Class  Arg:-  Arguments
  • 31. 31 Variable in Java  Variable is used to access data .  We use variable to store data.  Variable use for get input from user.  Variable used for give output to user.
  • 32. 32 Variable Declaration  We declare a variable in java same as in C++.  Syntax: Data_type variable_name;  DataTypes:  Data_types used for defined type of variable for example you store (10) integer data. We use int data type.  Varible_name:  Variable name is user defined. we can declare variable name following variable declaration rules
  • 33. 33 Data Types  Data Types that define which type of value used in program  There are many data types of java  Integer Data types Declaration of integer Variable Data_types Variablename;
  • 34. 34 Data types  Floating Data types Declaration of Floating Variable Data_types Variablename;
  • 35. 35 Java Output We use “System.out.println()” for print any message or result on screen. System.out.println(“ “) This is the name of class that contains the object out This is the name of class that contains the object out This is a static variable that in system class This is a static variable that in system class This a method in object out Whatever you specify between parenthesis () is passed to the println( ) method and displayed
  • 36. 36 System.out.println(); System.out.println(); It is used to display message, result and Message+Result. System is a class that is in java.lang package. Java.lang package by default import in netbean IDE. In println() method, “ln” use for new line.
  • 37. 37 System.out.println()  It used for 3 purpose “Message” , ”Result” and “Message + result” System.out.println(); Message Result Message + Result
  • 38. 38 System.out.println()/print(); Message Write Message in Double Quotes(” ”). Message Display as it we Write in Double Quotes.
  • 39. 39 System.out.println()/print(); Result Write Result in without Double Quotes(” ”). What is 15? Sum of two numbers? OR Product of two numbers?
  • 40. 40 System.out.println()/print(); Message+Result Write Message in Double Quotes(” ”). Write Result in without Double Quotes(” ”). For concatenation Message and result use plus(+) operator. Message Result OutputConcate.. .
  • 42. 42 Input in Java  For input in java  We import a scanner  We create a scanner object  We use methods. Firstly import Scanner Create object Use methods It is class name Object name it is user defined It is Constructer For Integer Number More function
  • 45. 45 Code of previous Image package javaapplication6; import java.util.*; public class JavaApplication6 { public static void main(String[] args) { Scanner obj=new Scanner(System.in); int num1,num2; System.out.print("Enter first integer number ::"); num1=obj.nextInt(); System.out.print("Enter Second integer number ::"); num2=obj.nextInt(); System.out.println(num1+"+"+num2+"="+(num1+num2)); } }