SlideShare a Scribd company logo
Introduction TO JAVA
Rishi Ram Khanal
BIM(TU)
History of Java
Java was developed by James Gosling at Sun
Microsoftsystem and it was originated at Sun
Microsystem in 1991
JAVA is Everywhere
Java resides in mobiles,client machines,sever
machine,embedded device,smart phones,
cloud etc.
It shares the same basic features of the
language and libraries
Principle of java:write once,Run
anywhere(WORA)
What is Library?
Java Library is a collection of predefined
classes.
You can use these classes either by inheriting
them or by instantiating them.
JAVA flavours
Java se(core java)
Java EE (Advance java)
Java ME(Mobile Edition for java)
Version History Of JAVA
Version NO of classes NO of package
Java 1.0 212 8
Java 1.1 503 23
Java 2 1520 29
Java 5 3562 166
Java 6 3792 203
Java 7 4024 209
Features of JAVA
Simple
Object oriented Language
Distributed
Interpreted
Robust
Secure
Portable
Multi-threaded
Garbage Collector
Installation of Java
How to Compile?
Hello.java Hello.class
How to Run
Hello.class
OS
Interpreter(just-in-time compiler)
Installation and setup
• http://www.oracle.com/technetwork/java/javase
/downloads/jdk8-downloads-2133151.html
• After installation we will see a java folder where u
install the java.Inside java folder we will see two
folder
• Jdk: java development Kit used for to write java
program
• Jre:Java Runtime Enviroment used for to run the
java files
JDK and JRE
Java Development Kit contains tools needed
to develop the java programs
These tools could be
compiler(javac.exe),Application
Launcher(java.exe) etc
Jre: Java Runtime Environment
It contains JVM(java Virtual Machine) and java
Package classes(java Library)
JVM
JVM is platform dependent
The java Virtual Machine provides a platform
–independent way of executing code
Java Virtual Machine Interprets the bytecode
Into machine code depending upon the
underlying operating system and hardware
combination
First Program JAVA
Remember
• Java is a case sensitive language like c and c++
• Java is nearly 100% object oriented language
• In java, it is possible to make a function which
is not a member of any class(as we can do in c
and C++)
First Program
Public class HelloWorld
{
public static void main(String args[])
{
System.out.println(“HelloWOrld”);
}
}
FOR pratical
• Write a program in notepad and save in bin
folder of jdk Compile and run the program
Delete the file from bin folder and make another
program in notepad and save in Desktop and
compile and run the program and please note
the error u got and how u solve the error
DataTypes and Keywords In java
 Java Identifiers
All the java components require names.Names used for
classes, variables and method are called identifiers.In java ,
there are several points to remember about identifiers.
• All identifiers should begin with a letter (A to Z or a to z),
currency character ($) or an underscore (_).
• After the first character, identifiers can have any combination
of characters.
• A keyword cannot be used as an identifier.
• Most importantly identifiers are case sensitive.
• Examples of legal identifiers:age, $salary, _value, __1_value
• Examples of illegal identifiers: 123abc, -salary
Java Keywords
• These reserved words may not be used as constant or variable or any other identifier
names.
WhiteSpace
Literals, Comments,Separators
Literals
A literal is a source code representation of a fixed value. They are
represented directly in the code without any computation.
Comments
Java supports single-line and multi-line comments very similar to c and
c++. All characters available inside any comment are ignored by Java
compiler.
/* This is my first java program.
This will print 'Hello World' as the output
This is an example of multi-line comments. */
// This is an example of single line comment /* This is also an example of
single line comment. */
Data Types in JAVA
Introduction to java
Details about Literals
Literals can be assigned to any primitive type variable. For example:
byte a =68;
char a ='A'
byte, int, long, and short can be expressed in decimal(
base 10),hexadecimal(base 16) or octal(base 8) number systems as well.
Prefix 0 is used to indicate octal and prefix 0x indicates hexadecimal when
using these number systems for literals. For example:
int decimal=100;
int octal =0144;
int hexa =0x64;
String literals in Java are specified like they are in most other languages by
enclosing a sequence of characters between a pair of double quotes.
String and char types of literals can contain any Unicode characters. For
example:
char a ='u0001'; String a ="u0001";
Variable
• In Java, all variables must be declared before they
can be used. The basic form of a variable
declaration is shown here:
type identifier [= value][, identifier [= value]...];
int a, b, c;// declares three ints, a, b, and c.
int d =3, e, f =5;// declares three more ints,
initializing // d and f.
byte z =22;// initializes z.
double pi =3.14159;// declares an approximation of
pi.
char x ='x';// the variable x has the value 'x'.
• This chapter will explain various variable types
available in Java Language. There are three
kinds of variables in Java:
• Local variables
• Instance variables
• Class/static variables
TYPECASTING in JAVA
Impicit Type Casting
Explicit Type Casting
SCANNER OBJECT
ARRAYS
ARRAY
• Declaring Array Variables:
To use an array in a program, you must declare a variable to
reference the array, and you must specify the type of array the variable
can reference. Here is the syntax for declaring an array variable:
dataType[] arrayRefVar; // preferred way.
or
dataType arrayRefVar[]; // works but not preferred way.
Example:
• The following code snippets are examples of this syntax:
double[] myList; // preferred way.
or
• double myList[]; // works but not preferred way.
Creating ARRAY
• You can create an array by using the new operator with the following
syntax:
• arrayRefVar = new dataType[arraySize];
• The above statement does two things:
• It creates an array using new dataType[arraySize];
• It assigns the reference of the newly created array to the variable
arrayRefVar.
• Declaring an array variable, creating an array, and assigning the reference
of the array to the variable can be combined in one statement, as shown
below:
• dataType[] arrayRefVar = new dataType[arraySize];
• Alternatively you can create arrays as follows:
• dataType[] arrayRefVar = {value0, value1, ..., valuek};
• The array elements are accessed through the index. Array indices are 0-
based; that is, they start from 0 to arrayRefVar.length-1.
• Following statement declares an array variable, myList,
creates an array of 10 elements of double type and assigns its
reference to myList:
• double[] myList = new double[10];
• Following picture represents array myList. Here, myList holds
ten double values and the indices are from 0 to 9.
The foreach Loops:
• JDK 1.5 introduced a new for loop known as
foreach loop or enhanced for loop, which
enables you to traverse the complete array
sequentially without using an index variable.
• SCANNER OBJECT
PRACTICAL
• TypeCasting Problem
• Declare an array whose size is 5 .Process the
array and Print all the elements of array and
find total sum of all elements and Find
greatest number from that element
• Implement foreach Loop
• Create a class , take the two input from
keyboard and sum two number and process
the array by using Scanner
Ad

More Related Content

What's hot (20)

Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented Programming
Ahmed Swilam
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
CPD INDIA
 
Python unit 3 m.sc cs
Python unit 3 m.sc csPython unit 3 m.sc cs
Python unit 3 m.sc cs
KALAISELVI P
 
CLASS & OBJECT IN JAVA
CLASS & OBJECT  IN JAVACLASS & OBJECT  IN JAVA
CLASS & OBJECT IN JAVA
Riaj Uddin Mahi
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
Lorna Mitchell
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
Jussi Pohjolainen
 
Object oreinted php | OOPs
Object oreinted php | OOPsObject oreinted php | OOPs
Object oreinted php | OOPs
Ravi Bhadauria
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
Synapseindiappsdevelopment
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
Tareq Hasan
 
Lect 1-java object-classes
Lect 1-java object-classesLect 1-java object-classes
Lect 1-java object-classes
Fajar Baskoro
 
Python – Object Oriented Programming
Python – Object Oriented Programming Python – Object Oriented Programming
Python – Object Oriented Programming
Raghunath A
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
Computer Programming 2
Computer Programming 2 Computer Programming 2
Computer Programming 2
VasanthiMuniasamy2
 
Java cheat sheet
Java cheat sheet Java cheat sheet
Java cheat sheet
Saifur Rahman
 
Object oriented approach in python programming
Object oriented approach in python programmingObject oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Advanced php
Advanced phpAdvanced php
Advanced php
hamfu
 
Unidad o informatica en ingles
Unidad o informatica en inglesUnidad o informatica en ingles
Unidad o informatica en ingles
Marisa Torrecillas
 
Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented Programming
Ahmed Swilam
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
CPD INDIA
 
Python unit 3 m.sc cs
Python unit 3 m.sc csPython unit 3 m.sc cs
Python unit 3 m.sc cs
KALAISELVI P
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
Lorna Mitchell
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
Jussi Pohjolainen
 
Object oreinted php | OOPs
Object oreinted php | OOPsObject oreinted php | OOPs
Object oreinted php | OOPs
Ravi Bhadauria
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
Synapseindiappsdevelopment
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
Tareq Hasan
 
Lect 1-java object-classes
Lect 1-java object-classesLect 1-java object-classes
Lect 1-java object-classes
Fajar Baskoro
 
Python – Object Oriented Programming
Python – Object Oriented Programming Python – Object Oriented Programming
Python – Object Oriented Programming
Raghunath A
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
Object oriented approach in python programming
Object oriented approach in python programmingObject oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Advanced php
Advanced phpAdvanced php
Advanced php
hamfu
 
Unidad o informatica en ingles
Unidad o informatica en inglesUnidad o informatica en ingles
Unidad o informatica en ingles
Marisa Torrecillas
 

Similar to Introduction to java (20)

Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
gkgupta1115
 
Introduction to java Programming Language
Introduction to java Programming LanguageIntroduction to java Programming Language
Introduction to java Programming Language
rubyjeyamani1
 
Hello java
Hello java  Hello java
Hello java
University of Babylon
 
Hello Java-First Level
Hello Java-First LevelHello Java-First Level
Hello Java-First Level
Dr. Raaid Alubady
 
Hello java
Hello java   Hello java
Hello java
University of Babylon
 
Chapter 2 java
Chapter 2 javaChapter 2 java
Chapter 2 java
Ahmad sohail Kakar
 
Java Basics.pptx from nit patna ece department
Java Basics.pptx from nit patna ece departmentJava Basics.pptx from nit patna ece department
Java Basics.pptx from nit patna ece department
om2348023vats
 
Java
JavaJava
Java
Raghu nath
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
ssuserb1a18d
 
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
AssignmentjsnsnshshusjdnsnshhzudjdndndjdAssignmentjsnsnshshusjdnsnshhzudjdndndjd
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
tusharjain613841
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
Jayfee Ramos
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
 
Java
JavaJava
Java
Zeeshan Khan
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
SmitNikumbh
 
PPT Lecture-1.2 java basics jvm, literals,
PPT Lecture-1.2 java basics jvm, literals,PPT Lecture-1.2 java basics jvm, literals,
PPT Lecture-1.2 java basics jvm, literals,
shubhamkumar248717
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Tajendar Arora
 
JAVA INETRNSHIP1 made with simple topics.ppt.pptx
JAVA INETRNSHIP1 made with simple topics.ppt.pptxJAVA INETRNSHIP1 made with simple topics.ppt.pptx
JAVA INETRNSHIP1 made with simple topics.ppt.pptx
fwzmypc2004
 
JAVA Basics Presentation for introduction to JAVA programming languauge
JAVA Basics Presentation for introduction to JAVA programming languaugeJAVA Basics Presentation for introduction to JAVA programming languauge
JAVA Basics Presentation for introduction to JAVA programming languauge
lakshyajain0740
 
Introduction to Java Basics Programming Java Basics-I.pptx
Introduction to Java Basics Programming Java Basics-I.pptxIntroduction to Java Basics Programming Java Basics-I.pptx
Introduction to Java Basics Programming Java Basics-I.pptx
SANDHYAP32
 
COMPUTER PROGRAMMING LANGUAGE.pptx
COMPUTER PROGRAMMING LANGUAGE.pptxCOMPUTER PROGRAMMING LANGUAGE.pptx
COMPUTER PROGRAMMING LANGUAGE.pptx
SofiaArquero2
 
Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
Java Unit-1.1 chunri kyu shuru kar rh koi si je di of du th n high ch ka dh h...
gkgupta1115
 
Introduction to java Programming Language
Introduction to java Programming LanguageIntroduction to java Programming Language
Introduction to java Programming Language
rubyjeyamani1
 
Java Basics.pptx from nit patna ece department
Java Basics.pptx from nit patna ece departmentJava Basics.pptx from nit patna ece department
Java Basics.pptx from nit patna ece department
om2348023vats
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
ssuserb1a18d
 
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
AssignmentjsnsnshshusjdnsnshhzudjdndndjdAssignmentjsnsnshshusjdnsnshhzudjdndndjd
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
tusharjain613841
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
SmitNikumbh
 
PPT Lecture-1.2 java basics jvm, literals,
PPT Lecture-1.2 java basics jvm, literals,PPT Lecture-1.2 java basics jvm, literals,
PPT Lecture-1.2 java basics jvm, literals,
shubhamkumar248717
 
JAVA INETRNSHIP1 made with simple topics.ppt.pptx
JAVA INETRNSHIP1 made with simple topics.ppt.pptxJAVA INETRNSHIP1 made with simple topics.ppt.pptx
JAVA INETRNSHIP1 made with simple topics.ppt.pptx
fwzmypc2004
 
JAVA Basics Presentation for introduction to JAVA programming languauge
JAVA Basics Presentation for introduction to JAVA programming languaugeJAVA Basics Presentation for introduction to JAVA programming languauge
JAVA Basics Presentation for introduction to JAVA programming languauge
lakshyajain0740
 
Introduction to Java Basics Programming Java Basics-I.pptx
Introduction to Java Basics Programming Java Basics-I.pptxIntroduction to Java Basics Programming Java Basics-I.pptx
Introduction to Java Basics Programming Java Basics-I.pptx
SANDHYAP32
 
COMPUTER PROGRAMMING LANGUAGE.pptx
COMPUTER PROGRAMMING LANGUAGE.pptxCOMPUTER PROGRAMMING LANGUAGE.pptx
COMPUTER PROGRAMMING LANGUAGE.pptx
SofiaArquero2
 
Ad

More from rishi ram khanal (20)

Measurement of gdp under product method
Measurement of gdp under product methodMeasurement of gdp under product method
Measurement of gdp under product method
rishi ram khanal
 
Major social problem in nepal child labour socilology
Major social problem in nepal child labour socilologyMajor social problem in nepal child labour socilology
Major social problem in nepal child labour socilology
rishi ram khanal
 
Light source ooad
Light source ooadLight source ooad
Light source ooad
rishi ram khanal
 
Introduction to artificial intelligence
Introduction to artificial intelligenceIntroduction to artificial intelligence
Introduction to artificial intelligence
rishi ram khanal
 
Interview method in research
Interview method in researchInterview method in research
Interview method in research
rishi ram khanal
 
Presentation on kurtosis statistics
Presentation on kurtosis statisticsPresentation on kurtosis statistics
Presentation on kurtosis statistics
rishi ram khanal
 
Importance of double entry accounting system for public limited company (basi...
Importance of double entry accounting system for public limited company (basi...Importance of double entry accounting system for public limited company (basi...
Importance of double entry accounting system for public limited company (basi...
rishi ram khanal
 
Implementation issues software engineering
Implementation issues software engineeringImplementation issues software engineering
Implementation issues software engineering
rishi ram khanal
 
Effect of migration in developing country
Effect of migration in developing countryEffect of migration in developing country
Effect of migration in developing country
rishi ram khanal
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
rishi ram khanal
 
Goals of firm business finance
Goals of firm business financeGoals of firm business finance
Goals of firm business finance
rishi ram khanal
 
General register organization (computer organization)
General register organization  (computer organization)General register organization  (computer organization)
General register organization (computer organization)
rishi ram khanal
 
GDP and trends economics .rishi
GDP and trends economics .rishiGDP and trends economics .rishi
GDP and trends economics .rishi
rishi ram khanal
 
Final internship-report on the networking department of the internet service ...
Final internship-report on the networking department of the internet service ...Final internship-report on the networking department of the internet service ...
Final internship-report on the networking department of the internet service ...
rishi ram khanal
 
Field study of crystal finance share broker
Field study of crystal finance share brokerField study of crystal finance share broker
Field study of crystal finance share broker
rishi ram khanal
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
rishi ram khanal
 
Computer virus and worms
Computer virus and wormsComputer virus and worms
Computer virus and worms
rishi ram khanal
 
Database management system
Database management systemDatabase management system
Database management system
rishi ram khanal
 
Credential reuse cyber security
Credential reuse cyber securityCredential reuse cyber security
Credential reuse cyber security
rishi ram khanal
 
Cisco packet tracer router
Cisco packet tracer  routerCisco packet tracer  router
Cisco packet tracer router
rishi ram khanal
 
Measurement of gdp under product method
Measurement of gdp under product methodMeasurement of gdp under product method
Measurement of gdp under product method
rishi ram khanal
 
Major social problem in nepal child labour socilology
Major social problem in nepal child labour socilologyMajor social problem in nepal child labour socilology
Major social problem in nepal child labour socilology
rishi ram khanal
 
Introduction to artificial intelligence
Introduction to artificial intelligenceIntroduction to artificial intelligence
Introduction to artificial intelligence
rishi ram khanal
 
Interview method in research
Interview method in researchInterview method in research
Interview method in research
rishi ram khanal
 
Presentation on kurtosis statistics
Presentation on kurtosis statisticsPresentation on kurtosis statistics
Presentation on kurtosis statistics
rishi ram khanal
 
Importance of double entry accounting system for public limited company (basi...
Importance of double entry accounting system for public limited company (basi...Importance of double entry accounting system for public limited company (basi...
Importance of double entry accounting system for public limited company (basi...
rishi ram khanal
 
Implementation issues software engineering
Implementation issues software engineeringImplementation issues software engineering
Implementation issues software engineering
rishi ram khanal
 
Effect of migration in developing country
Effect of migration in developing countryEffect of migration in developing country
Effect of migration in developing country
rishi ram khanal
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
rishi ram khanal
 
Goals of firm business finance
Goals of firm business financeGoals of firm business finance
Goals of firm business finance
rishi ram khanal
 
General register organization (computer organization)
General register organization  (computer organization)General register organization  (computer organization)
General register organization (computer organization)
rishi ram khanal
 
GDP and trends economics .rishi
GDP and trends economics .rishiGDP and trends economics .rishi
GDP and trends economics .rishi
rishi ram khanal
 
Final internship-report on the networking department of the internet service ...
Final internship-report on the networking department of the internet service ...Final internship-report on the networking department of the internet service ...
Final internship-report on the networking department of the internet service ...
rishi ram khanal
 
Field study of crystal finance share broker
Field study of crystal finance share brokerField study of crystal finance share broker
Field study of crystal finance share broker
rishi ram khanal
 
Database management system
Database management systemDatabase management system
Database management system
rishi ram khanal
 
Credential reuse cyber security
Credential reuse cyber securityCredential reuse cyber security
Credential reuse cyber security
rishi ram khanal
 
Cisco packet tracer router
Cisco packet tracer  routerCisco packet tracer  router
Cisco packet tracer router
rishi ram khanal
 
Ad

Recently uploaded (20)

The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 

Introduction to java

  • 1. Introduction TO JAVA Rishi Ram Khanal BIM(TU)
  • 2. History of Java Java was developed by James Gosling at Sun Microsoftsystem and it was originated at Sun Microsystem in 1991
  • 3. JAVA is Everywhere Java resides in mobiles,client machines,sever machine,embedded device,smart phones, cloud etc. It shares the same basic features of the language and libraries Principle of java:write once,Run anywhere(WORA)
  • 4. What is Library? Java Library is a collection of predefined classes. You can use these classes either by inheriting them or by instantiating them. JAVA flavours Java se(core java) Java EE (Advance java) Java ME(Mobile Edition for java)
  • 5. Version History Of JAVA Version NO of classes NO of package Java 1.0 212 8 Java 1.1 503 23 Java 2 1520 29 Java 5 3562 166 Java 6 3792 203 Java 7 4024 209
  • 6. Features of JAVA Simple Object oriented Language Distributed Interpreted Robust Secure Portable Multi-threaded Garbage Collector
  • 7. Installation of Java How to Compile? Hello.java Hello.class How to Run Hello.class OS Interpreter(just-in-time compiler)
  • 8. Installation and setup • http://www.oracle.com/technetwork/java/javase /downloads/jdk8-downloads-2133151.html • After installation we will see a java folder where u install the java.Inside java folder we will see two folder • Jdk: java development Kit used for to write java program • Jre:Java Runtime Enviroment used for to run the java files
  • 9. JDK and JRE Java Development Kit contains tools needed to develop the java programs These tools could be compiler(javac.exe),Application Launcher(java.exe) etc Jre: Java Runtime Environment It contains JVM(java Virtual Machine) and java Package classes(java Library)
  • 10. JVM JVM is platform dependent The java Virtual Machine provides a platform –independent way of executing code Java Virtual Machine Interprets the bytecode Into machine code depending upon the underlying operating system and hardware combination
  • 11. First Program JAVA Remember • Java is a case sensitive language like c and c++ • Java is nearly 100% object oriented language • In java, it is possible to make a function which is not a member of any class(as we can do in c and C++)
  • 12. First Program Public class HelloWorld { public static void main(String args[]) { System.out.println(“HelloWOrld”); } }
  • 13. FOR pratical • Write a program in notepad and save in bin folder of jdk Compile and run the program Delete the file from bin folder and make another program in notepad and save in Desktop and compile and run the program and please note the error u got and how u solve the error
  • 14. DataTypes and Keywords In java  Java Identifiers All the java components require names.Names used for classes, variables and method are called identifiers.In java , there are several points to remember about identifiers. • All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_). • After the first character, identifiers can have any combination of characters. • A keyword cannot be used as an identifier. • Most importantly identifiers are case sensitive. • Examples of legal identifiers:age, $salary, _value, __1_value • Examples of illegal identifiers: 123abc, -salary
  • 15. Java Keywords • These reserved words may not be used as constant or variable or any other identifier names.
  • 17. Literals, Comments,Separators Literals A literal is a source code representation of a fixed value. They are represented directly in the code without any computation. Comments Java supports single-line and multi-line comments very similar to c and c++. All characters available inside any comment are ignored by Java compiler. /* This is my first java program. This will print 'Hello World' as the output This is an example of multi-line comments. */ // This is an example of single line comment /* This is also an example of single line comment. */
  • 20. Details about Literals Literals can be assigned to any primitive type variable. For example: byte a =68; char a ='A' byte, int, long, and short can be expressed in decimal( base 10),hexadecimal(base 16) or octal(base 8) number systems as well. Prefix 0 is used to indicate octal and prefix 0x indicates hexadecimal when using these number systems for literals. For example: int decimal=100; int octal =0144; int hexa =0x64; String literals in Java are specified like they are in most other languages by enclosing a sequence of characters between a pair of double quotes. String and char types of literals can contain any Unicode characters. For example: char a ='u0001'; String a ="u0001";
  • 21. Variable • In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here: type identifier [= value][, identifier [= value]...]; int a, b, c;// declares three ints, a, b, and c. int d =3, e, f =5;// declares three more ints, initializing // d and f. byte z =22;// initializes z. double pi =3.14159;// declares an approximation of pi. char x ='x';// the variable x has the value 'x'.
  • 22. • This chapter will explain various variable types available in Java Language. There are three kinds of variables in Java: • Local variables • Instance variables • Class/static variables
  • 23. TYPECASTING in JAVA Impicit Type Casting Explicit Type Casting SCANNER OBJECT ARRAYS
  • 24. ARRAY • Declaring Array Variables: To use an array in a program, you must declare a variable to reference the array, and you must specify the type of array the variable can reference. Here is the syntax for declaring an array variable: dataType[] arrayRefVar; // preferred way. or dataType arrayRefVar[]; // works but not preferred way. Example: • The following code snippets are examples of this syntax: double[] myList; // preferred way. or • double myList[]; // works but not preferred way.
  • 25. Creating ARRAY • You can create an array by using the new operator with the following syntax: • arrayRefVar = new dataType[arraySize]; • The above statement does two things: • It creates an array using new dataType[arraySize]; • It assigns the reference of the newly created array to the variable arrayRefVar. • Declaring an array variable, creating an array, and assigning the reference of the array to the variable can be combined in one statement, as shown below: • dataType[] arrayRefVar = new dataType[arraySize]; • Alternatively you can create arrays as follows: • dataType[] arrayRefVar = {value0, value1, ..., valuek}; • The array elements are accessed through the index. Array indices are 0- based; that is, they start from 0 to arrayRefVar.length-1.
  • 26. • Following statement declares an array variable, myList, creates an array of 10 elements of double type and assigns its reference to myList: • double[] myList = new double[10]; • Following picture represents array myList. Here, myList holds ten double values and the indices are from 0 to 9.
  • 27. The foreach Loops: • JDK 1.5 introduced a new for loop known as foreach loop or enhanced for loop, which enables you to traverse the complete array sequentially without using an index variable. • SCANNER OBJECT
  • 28. PRACTICAL • TypeCasting Problem • Declare an array whose size is 5 .Process the array and Print all the elements of array and find total sum of all elements and Find greatest number from that element • Implement foreach Loop • Create a class , take the two input from keyboard and sum two number and process the array by using Scanner