SlideShare a Scribd company logo
AI Programming
with JAVA
By:Virat Andodariya
M.S.University
1
How Artificial Intelligence Programmed?
Java Basics
Graph coloring Problem
Uniform Cost Search
Contents
2
How Artificial Intelligence Programmed?
C++
C#
Java
Lisp
Python
3
Java Basics
• The Java Virtual Machine
• Applications & Applets
• Classes & Objects
• Start up Java
• Variables & Assignments
• Strings & Characters
• Arithmetic Operators & Expressions
• Comments
• Keywords
• Creating and Compiling Programs
• Modifiers
4
Bytecodes and the Java Virtual Machine
5
Java Program
• Java Application Program
– Application
• Program written in general programming language
– Applet
• Program running in Web Browser Environment
• Can be viewed by appletviewer or Web browser with
JVM
6
Classes and Objects
• Object
– Memory Space to Define State and Operation
– Instance of Class
• Class
– A class is a template or blueprint for objects. To program in
Java, you must understand classes and be able to write and
use them.
– Template of Creating Object
7
The Java Class Libraries
• java.applet : Applet related
• java.awt : Abstract Window Toolkit
• java.awt.event : Event process from awt component
• java.awt.image : Image processing
• java.beans : JavaBeans Component
• java.io : File or Network I/O Support
• java.lang : Java Language Support
• java.net : Network related functions
• java.util : Utility function
8
Start a Java Application
9
Variables and Assignments
• Types
– char 16bits Unicode character data
– boolean Boolean Variable
– byte 8 bits signed integer
– short 16 bits signed integer
– int 32 bits signed integer
– long 64 bits signed integer
– float 32 bits signed floating point number
– double 64 bits signed floating point number
10
Variables and Assignments
• String : sequence of character
String s = “Enter an integer value: ” ;
• Concatenation Operator ‘+’
String s = “Lincoln said: ” + “” Four score and seven years
ago”” ;
Result :
Lincoln said: “Four score and seven years ago”
11
Comments
• Single Line Comment
– int i = 10 ; // i is counter
• Multiple Line Comment
/*
Some comments
*/
• Documentation Comment
/**
Documentation Comment
*/
12
Java Keywords
• 50 Java Keywords
abstract double int super
boolean else interface s witch
break extends long synchronized
byte final native this
case finally new throw
catch float package throws
char for private transient*
class goto* protected try
const* if public void
continue implements return volatile
default import short while
do instanceof static strictfp
assert (New in 1.5) enum (New in 1.5)
13
Control Statement
• A statement represents an action or a sequence of actions.
To change the execution order of program
• As the method of controlling the execution order
– Conditional Statement : if St., switch St.
– Repeat Statement : for St., while St., do-while St.
– Branch Statement : break St., continue St., return St.
14
For Statement
 Repeat the sequence of statement as many as defined.
 Form of for statement
for ( <expr. 1> ; < expr. 2> ; < expr. 3>)
<statement>
 <expr. 1> : initialize the control variable
 <expr. 2> : check the control variable
 <expr. 3> : modify the control variable
s = 0;
for (i=1; i<=N; ++i) // sum from 1 to N : i increment
s += i;
15
Break Statement
• To move control to the out of the block
• From of break statement
break [label] ;
16
Source Code
Create/Modify Source Code
Compile Source Code
i.e. javac Welcome.java
Bytecode
Run Byteode
i.e. java Welcome
Result
If compilation errors
If runtime errors or incorrect result
17
Modifiers
Java uses certain reserved words called modifiers that specify
the properties of the data, methods, and classes and how
they can be used.
Examples of modifiers are public and static. Other modifiers are
private, final, abstract, and protected. A public datum,
method, or class can be accessed by other programs. A
private datum or method cannot be accessed by other
programs.
18
Graph coloring Problem
Graph In Matrix
19
Graph Coloring
20
21
22
23
24
Result
25
UniformCostSearch
26
27
28
29
30
31
32
33
34
35
36
37
38
References
• Java™ 2:The Complete Reference,Fifth Edition
Herbert Schildt
• JDK Developer Kit
• JGRASP (CSD) Compiler
39
Thank you
40

More Related Content

PDF
Zero-Knowledge Proofs: Identity Proofing and Authentication
PDF
100人100通りの働き方を支えるサイボウズ流情報システム部門の在り方
PPT
Cryptography.ppt
PPTX
인공지능, 기계학습 그리고 딥러닝
PDF
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
PDF
Misleading Ads & Trademarks
PDF
R Markdown, Rpubs & github publishing and Shiny by Example
PDF
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
Zero-Knowledge Proofs: Identity Proofing and Authentication
100人100通りの働き方を支えるサイボウズ流情報システム部門の在り方
Cryptography.ppt
인공지능, 기계학습 그리고 딥러닝
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Misleading Ads & Trademarks
R Markdown, Rpubs & github publishing and Shiny by Example
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발

Viewers also liked (20)

PPTX
artificial intelligence
PPTX
Future of Java EE with Java SE 8
PDF
Java EE Next
PPTX
Building Cognitive Applications with Watson APIs
PDF
EIA2016Nice - Landry Holi_How AI Can Shape the Future of Travel
ODP
Deep Learning meetup
PPT
Have You Seen Java EE Lately?
PDF
Java EE Revisits GoF Design Patterns
PDF
Java EE 8 Recipes
PDF
Java EE 8 - February 2017 update
PDF
Java EE 8 Web Frameworks: A Look at JSF vs MVC
PDF
Java EE 8: On the Horizon
PDF
Artificial Intelligence in Project Management by Dr. Khaled A. Hamdy
PDF
Barreras afectivas
PPTX
Java EE 8: What Servlet 4 and HTTP2 Mean
PPT
JavaScript Frameworks and Java EE – A Great Match
PDF
10 Revealing Statistics About Compensation & Benefits You should Know
PPT
Down-to-Earth Microservices with Java EE
PDF
Hype vs. Reality: The AI Explainer
artificial intelligence
Future of Java EE with Java SE 8
Java EE Next
Building Cognitive Applications with Watson APIs
EIA2016Nice - Landry Holi_How AI Can Shape the Future of Travel
Deep Learning meetup
Have You Seen Java EE Lately?
Java EE Revisits GoF Design Patterns
Java EE 8 Recipes
Java EE 8 - February 2017 update
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8: On the Horizon
Artificial Intelligence in Project Management by Dr. Khaled A. Hamdy
Barreras afectivas
Java EE 8: What Servlet 4 and HTTP2 Mean
JavaScript Frameworks and Java EE – A Great Match
10 Revealing Statistics About Compensation & Benefits You should Know
Down-to-Earth Microservices with Java EE
Hype vs. Reality: The AI Explainer
Ad

Similar to JAVA in Artificial intelligent (20)

PPTX
Java Android Programming for MAD lab Fundamentals
PPT
skill lab-java interview preparation questions.ppt
PPT
CSL101_Ch1.ppt
PPTX
CSL101_Ch1.pptx
PPTX
CSL101_Ch1.pptx
PPT
CSL101_Ch1.ppt
PPTX
JAVA CLASS PPT FOR ENGINEERING STUDENTS BBBBBBBBBBBBBBBBBBB
PPT
JAVA_BASICS_Data_abstraction_encapsulation.ppt
PPT
Presentation on programming language on java.ppt
PPTX
Java platform
PPSX
DITEC - Programming with Java
PPT
CSL101_Ch1.ppt Computer Science
PPT
Programming with Java by Faizan Ahmed & Team
PPT
Introduction to java programming with Fundamentals
PPTX
UNIT – 2 Features of java- (Shilpa R).pptx
PPT
Java Concepts with object oriented programming
PPT
java programming for engineering students_Ch1.ppt
PPT
Mobile computing for Bsc Computer Science
PPT
Programming with Java - Essentials to program
PPTX
Modern_2.pptx for java
Java Android Programming for MAD lab Fundamentals
skill lab-java interview preparation questions.ppt
CSL101_Ch1.ppt
CSL101_Ch1.pptx
CSL101_Ch1.pptx
CSL101_Ch1.ppt
JAVA CLASS PPT FOR ENGINEERING STUDENTS BBBBBBBBBBBBBBBBBBB
JAVA_BASICS_Data_abstraction_encapsulation.ppt
Presentation on programming language on java.ppt
Java platform
DITEC - Programming with Java
CSL101_Ch1.ppt Computer Science
Programming with Java by Faizan Ahmed & Team
Introduction to java programming with Fundamentals
UNIT – 2 Features of java- (Shilpa R).pptx
Java Concepts with object oriented programming
java programming for engineering students_Ch1.ppt
Mobile computing for Bsc Computer Science
Programming with Java - Essentials to program
Modern_2.pptx for java
Ad

Recently uploaded (20)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Construction Project Organization Group 2.pptx
PDF
Well-logging-methods_new................
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
web development for engineering and engineering
PPTX
Sustainable Sites - Green Building Construction
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Artificial Intelligence
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Current and future trends in Computer Vision.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
CH1 Production IntroductoryConcepts.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Model Code of Practice - Construction Work - 21102022 .pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Construction Project Organization Group 2.pptx
Well-logging-methods_new................
Foundation to blockchain - A guide to Blockchain Tech
web development for engineering and engineering
Sustainable Sites - Green Building Construction
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Artificial Intelligence
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Internet of Things (IOT) - A guide to understanding
Current and future trends in Computer Vision.pptx

JAVA in Artificial intelligent

  • 1. AI Programming with JAVA By:Virat Andodariya M.S.University 1
  • 2. How Artificial Intelligence Programmed? Java Basics Graph coloring Problem Uniform Cost Search Contents 2
  • 3. How Artificial Intelligence Programmed? C++ C# Java Lisp Python 3
  • 4. Java Basics • The Java Virtual Machine • Applications & Applets • Classes & Objects • Start up Java • Variables & Assignments • Strings & Characters • Arithmetic Operators & Expressions • Comments • Keywords • Creating and Compiling Programs • Modifiers 4
  • 5. Bytecodes and the Java Virtual Machine 5
  • 6. Java Program • Java Application Program – Application • Program written in general programming language – Applet • Program running in Web Browser Environment • Can be viewed by appletviewer or Web browser with JVM 6
  • 7. Classes and Objects • Object – Memory Space to Define State and Operation – Instance of Class • Class – A class is a template or blueprint for objects. To program in Java, you must understand classes and be able to write and use them. – Template of Creating Object 7
  • 8. The Java Class Libraries • java.applet : Applet related • java.awt : Abstract Window Toolkit • java.awt.event : Event process from awt component • java.awt.image : Image processing • java.beans : JavaBeans Component • java.io : File or Network I/O Support • java.lang : Java Language Support • java.net : Network related functions • java.util : Utility function 8
  • 9. Start a Java Application 9
  • 10. Variables and Assignments • Types – char 16bits Unicode character data – boolean Boolean Variable – byte 8 bits signed integer – short 16 bits signed integer – int 32 bits signed integer – long 64 bits signed integer – float 32 bits signed floating point number – double 64 bits signed floating point number 10
  • 11. Variables and Assignments • String : sequence of character String s = “Enter an integer value: ” ; • Concatenation Operator ‘+’ String s = “Lincoln said: ” + “” Four score and seven years ago”” ; Result : Lincoln said: “Four score and seven years ago” 11
  • 12. Comments • Single Line Comment – int i = 10 ; // i is counter • Multiple Line Comment /* Some comments */ • Documentation Comment /** Documentation Comment */ 12
  • 13. Java Keywords • 50 Java Keywords abstract double int super boolean else interface s witch break extends long synchronized byte final native this case finally new throw catch float package throws char for private transient* class goto* protected try const* if public void continue implements return volatile default import short while do instanceof static strictfp assert (New in 1.5) enum (New in 1.5) 13
  • 14. Control Statement • A statement represents an action or a sequence of actions. To change the execution order of program • As the method of controlling the execution order – Conditional Statement : if St., switch St. – Repeat Statement : for St., while St., do-while St. – Branch Statement : break St., continue St., return St. 14
  • 15. For Statement  Repeat the sequence of statement as many as defined.  Form of for statement for ( <expr. 1> ; < expr. 2> ; < expr. 3>) <statement>  <expr. 1> : initialize the control variable  <expr. 2> : check the control variable  <expr. 3> : modify the control variable s = 0; for (i=1; i<=N; ++i) // sum from 1 to N : i increment s += i; 15
  • 16. Break Statement • To move control to the out of the block • From of break statement break [label] ; 16
  • 17. Source Code Create/Modify Source Code Compile Source Code i.e. javac Welcome.java Bytecode Run Byteode i.e. java Welcome Result If compilation errors If runtime errors or incorrect result 17
  • 18. Modifiers Java uses certain reserved words called modifiers that specify the properties of the data, methods, and classes and how they can be used. Examples of modifiers are public and static. Other modifiers are private, final, abstract, and protected. A public datum, method, or class can be accessed by other programs. A private datum or method cannot be accessed by other programs. 18
  • 21. 21
  • 22. 22
  • 23. 23
  • 24. 24
  • 27. 27
  • 28. 28
  • 29. 29
  • 30. 30
  • 31. 31
  • 32. 32
  • 33. 33
  • 34. 34
  • 35. 35
  • 36. 36
  • 37. 37
  • 38. 38
  • 39. References • Java™ 2:The Complete Reference,Fifth Edition Herbert Schildt • JDK Developer Kit • JGRASP (CSD) Compiler 39