Top Banner
UNIT- I CHAPTER IN BOOK- 2 OVERVIEW OF JAVA -K. Indhu
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter2_OverviewOfJava

UNIT- ICHAPTER IN BOOK- 2OVERVIEW OF JAVA

-K. Indhu

Page 2: Chapter2_OverviewOfJava

K. INDHU 2

SYLLABUS COVERED HERE• Overview Of Java

Page 3: Chapter2_OverviewOfJava

K. INDHU 3

GOALS1. Introduction2. OOP (Encapsulation) in Java3. OOP (Inheritance) in Java4. OOP (Polymorphism) in Java5. Getting Started with Java Program6. Compiling Java Program7. Creating & Compiling Java Application8. Executing Java Application9. Comments in Java10. Block of a Program11. Second Short Java Program12. main() Method in Java13. Third short Java Program14. Java Lexical Issues

Page 4: Chapter2_OverviewOfJava

K. INDHU 4

INTRODUCTION• Two Paradigms-> (i) Process Oriented Model,• (ii) Object Oriented Model.

• The process-oriented model can be thought of as code acting on data.

• C implements process-oriented model.

• An object-oriented model can be characterized as data controlling access to code.

• C++, Java implements object-oriented model.

Page 5: Chapter2_OverviewOfJava

K. INDHU 5

OOP (ENCAPSULATION) IN JAVA

Page 6: Chapter2_OverviewOfJava

K. INDHU 6

OOP (INHERITANCE) IN JAVA

Page 7: Chapter2_OverviewOfJava

K. INDHU 7

OOP (POLYMORPHISM) IN JAVA

Page 8: Chapter2_OverviewOfJava

K. INDHU 8

GETTING STARTED WITH JAVA PROG.1. Write a Simple Java Application,2. Save the Java Application as-> “Example.java”,

3. Compile the Java Application,

4. Run / Execute the Java Application.

Page 9: Chapter2_OverviewOfJava

K. INDHU 9

GETTING STARTED WITH JAVA PROG.• The Java compiler requires that a source file use the .java filename

extension.

• The name of that class (in the code snippet) should match the name of the file that holds the program.

• Make sure that the capitalization of the filename matches the class name.(The reason for this is that Java is case-sensitive.)

Page 10: Chapter2_OverviewOfJava

K. INDHU 10

COMPILING JAVA PROGRAM

Page 11: Chapter2_OverviewOfJava

K. INDHU 11

CREATING & COMPILING JAVA APPLN.

Page 12: Chapter2_OverviewOfJava

K. INDHU 12

EXECUTING JAVA APPLN.

Page 13: Chapter2_OverviewOfJava

K. INDHU 13

COMMENTS IN JAVA• (1) int i = 10; // i is used as a counter

• (2) THE MULTILINE COMMENT • This form of comment may also extend over several lines as

shown here:• /*• This is a longer comment• that extends over • five lines. • */ P• (3) This is the documentation comment. • /**• This is a Java documentation comment.• */

Page 14: Chapter2_OverviewOfJava

K. INDHU 14

BLOCK OF A PROGRAM• A pair of braces ( {...........} ) in a program forms a block that

groups components of a program.

Page 15: Chapter2_OverviewOfJava

K. INDHU 15

SECOND SHORT JAVA PROGRAM

Page 16: Chapter2_OverviewOfJava

K. INDHU 16

main() METHOD IN JAVA• The main method provides the control of program flow. The Java

interpreter executes the application by invoking the main method. • • The main method looks like this->• public static void main(String[] args)• {• // Statements;• }

Page 17: Chapter2_OverviewOfJava

K. INDHU 17

THIRD SHORT JAVA PROGRAM

Page 18: Chapter2_OverviewOfJava

K. INDHU 18

JAVA LEXICAL ISSUES

Page 19: Chapter2_OverviewOfJava

K. INDHU 19

SO FAR WE STUDIED…• Overview of Java

Page 20: Chapter2_OverviewOfJava

HAPPY LEARNING!!!