SlideShare a Scribd company logo
5
Most read
6
Most read
7
Most read
JAVA
P.Prathibha
Topics for Today’s Session
Differences between C,
C++ & Java
Structure of a Java
Program
Differences between C, C++ and Java
Feature C C++ Java
Programming
Paradigm
Procedural
language
Object-Oriented
Programming (OOP)
Pure Object
Oriented Oriented
Origin
Based on assembly
language
Based on C language Based on C and C++
Developer
Dennis Ritchie in
1972
Bjarne Stroustrup in
1979
James Gosling in
1991
Translator Compiler only Compiler only
Interpreted language
(Compiler + interpreter)
Platform
Dependency
Platform Dependent Platform Dependent
Platform
Independent
Code execution Direct Direct Executed by JVM
Approach Top-down Bottom-up Bottom-up
File generation .exe files .exe files .class files
Pre-processor
directives
Support header files
(#include, #define)
Supported (#header,
#define)
Use Packages
(import)
keywords 32 keywords 63 keywords 50 keywords
Contd..
Feature C C++ Java
Datatypes (union,
structure)
Supported Supported Not supported
Inheritance No inheritance Supported
Supported except
Multiple inheritance
Overloading No overloading
Support Function overloading
(Polymorphism)
Operator overloading is
not supported
Pointers Supported Supported Not supported
Allocation Use malloc, calloc Use new, delete Garbage collector
Exception Handling Not supported Supported Supported
Templates Not supported Supported Not supported
Destructors
No constructor
neither destructor
Supported Not supported
Multithreading/
Interfaces
Not supported Not supported Supported
Database
connectivity
Not supported Not supported Supported
Storage Classes
Supported ( auto,
extern )
Supported ( auto, extern ) Not supported
Structure of a Java Program
Documentation Section:
 It includes the comments that improve the readability of the
program.
 It consists comments in Java that describe the purpose of the
program, author name, date and time of program creation.
 This section is optional and comments may appear anywhere
in the program.
Java programming language supports three types of
comments..
 Single line Comment (or end-of line comment)
 It starts with a double slash symbol (//) and terminates at the end
of the current line.
Ex: // sum of two numbers
 Multi-line Comment
/* a multi-line comment is declared like this
and can have multiple lines as a comment */
 Documentation Comment
 /** a documentation comment starts with a delimiter and ends
with */
Package Statement
 A package is a collection of classes, interfaces and sub-
packages.
 A sub package contains collection of classes, interfaces and
sub-sub packages etc.
 There is a provision in Java that allows you to declare your
classes in a collection called package.
 There can be only one package statement in a Java program.
 It must appear as the first statement in the source code file
before any class or interface declaration.
 This statement is optional,
Syntax: package package_name;
Example: package student;
 This statement declares that all the classes and interfaces
defined in this source file are a part of the student package.
java.lang.*;
package is imported by default and this package is
known as default package.
Import Statement
 Many predefined classes are stored in packages in Java, an
import statement is used to refer to the classes stored in other
packages.
 An import statement is always written after the package
statement but it has to be before any class declaration.
 You can import a specific class or all the classes of the
package.
 Many classes can be imported in a single program and hence
multiple import statements can be written.
import java.util.Date; //imports the date class
import java.applet.*; //imports all the classes from the java applet package
Interface Section
 This section is used to specify an interface in Java.
 It is an optional section which is mainly used to implement
multiple inheritance in Java
 An interface is similar to a class but contains only constants
and method declarations.
 An Interfaces cannot be instantiated.
 They can only be implemented by classes or extended by other
interfaces.
Interface shape{
void draw(int length, int bredth);
void show();
}
Class Definition
 Java program may contain multiple class definition.
 Classes are primary feature of Java program.
 The classes are used to map real world problems.
 classes defines the information about the user-defined classes
in a program.
 A class is a collection of variables and methods that operate on
the fields.
 Every program in Java will have at least one class with the main
method.
class Addition
{
void add(String args[])
{
int a=2, b=3, c;
c=a+b;
System.out.println(c);
}
}
Main Method Class
 Execution of a Java application starts from the main method.
 In other words, its an entry point for the class or program that
starts in Java Run-time.
 The main () method which is from where the execution of program
actually starts and follow the statements in the order specified.
 The main method can create objects, evaluate expressions, and invoke
other methods and much more.
 On reaching the end of main, the program terminates and control
passes back to the operating system.
 The class section is mandatory.
// Program to display message on the screen
class HelloJava {
public static void main(String args[])
{
System.out.println("Hello Harsha");
} }
Summary
 In this lesson you learnt about
 Java
 Differences between C , C++ and Java
 Structure of Java Program
Structure of java program  diff c- cpp and java

More Related Content

What's hot (20)

PPTX
java interface and packages
VINOTH R
 
PPTX
This keyword in java
Hitesh Kumar
 
PPTX
class and objects
Payel Guria
 
PPTX
I/O Streams
Ravi Chythanya
 
PPTX
Operator overloading
Burhan Ahmed
 
PPTX
Access Modifier.pptx
Margaret Mary
 
PPTX
Super Keyword in Java.pptx
KrutikaWankhade1
 
PPT
Java Presentation
pm2214
 
PDF
Arrays in Java
Naz Abdalla
 
PPTX
Classes, objects in JAVA
Abhilash Nair
 
PPTX
Constructor in java
Pavith Gunasekara
 
PPTX
classes and objects in C++
HalaiHansaika
 
PPTX
Constructor and Types of Constructors
Dhrumil Panchal
 
PPT
Final keyword in java
Lovely Professional University
 
PPTX
07. Virtual Functions
Haresh Jaiswal
 
PPTX
Strings in c++
Neeru Mittal
 
PDF
Operator overloading C++
Lahiru Dilshan
 
PPTX
Constructor overloading & method overloading
garishma bhatia
 
PDF
Constructor and Destructor
Kamal Acharya
 
java interface and packages
VINOTH R
 
This keyword in java
Hitesh Kumar
 
class and objects
Payel Guria
 
I/O Streams
Ravi Chythanya
 
Operator overloading
Burhan Ahmed
 
Access Modifier.pptx
Margaret Mary
 
Super Keyword in Java.pptx
KrutikaWankhade1
 
Java Presentation
pm2214
 
Arrays in Java
Naz Abdalla
 
Classes, objects in JAVA
Abhilash Nair
 
Constructor in java
Pavith Gunasekara
 
classes and objects in C++
HalaiHansaika
 
Constructor and Types of Constructors
Dhrumil Panchal
 
Final keyword in java
Lovely Professional University
 
07. Virtual Functions
Haresh Jaiswal
 
Strings in c++
Neeru Mittal
 
Operator overloading C++
Lahiru Dilshan
 
Constructor overloading & method overloading
garishma bhatia
 
Constructor and Destructor
Kamal Acharya
 

Similar to Structure of java program diff c- cpp and java (20)

PPTX
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
PPT
java01.ppt
Godwin585235
 
PDF
Lec 5 13_aug [compatibility mode]
Palak Sanghani
 
PPT
JAVA_BASICS.ppt
VGaneshKarthikeyan
 
DOCX
Unit2 java
mrecedu
 
PPT
Present the syntax of Java Introduce the Java
ssuserfd620b
 
PPT
java_ notes_for__________basic_level.ppt
amisharawat149
 
PPT
java ppt for basic intro about java and its
kssandhu875
 
PPT
Java - A parent language and powerdul for mobile apps.
dhimananshu130803
 
PPT
Java intro
Sonam Sharma
 
PPT
Java01
Remon Hanna
 
PPT
Java01
Dhaval Patel
 
PPT
Core_java_ppt.ppt
SHIBDASDUTTA
 
PPT
Java_presesntation.ppt
VGaneshKarthikeyan
 
PPT
java01.ppt
SouravGhosh305827
 
PPTX
mukul Dubey.pptx
CodeHome
 
PPT
java01.ppt
ROGNationYT
 
PPT
java01.ppt
ShivamChaturvedi67
 
PPT
java01.ppt
FakeBuddy2
 
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
java01.ppt
Godwin585235
 
Lec 5 13_aug [compatibility mode]
Palak Sanghani
 
JAVA_BASICS.ppt
VGaneshKarthikeyan
 
Unit2 java
mrecedu
 
Present the syntax of Java Introduce the Java
ssuserfd620b
 
java_ notes_for__________basic_level.ppt
amisharawat149
 
java ppt for basic intro about java and its
kssandhu875
 
Java - A parent language and powerdul for mobile apps.
dhimananshu130803
 
Java intro
Sonam Sharma
 
Java01
Remon Hanna
 
Java01
Dhaval Patel
 
Core_java_ppt.ppt
SHIBDASDUTTA
 
Java_presesntation.ppt
VGaneshKarthikeyan
 
java01.ppt
SouravGhosh305827
 
mukul Dubey.pptx
CodeHome
 
java01.ppt
ROGNationYT
 
java01.ppt
ShivamChaturvedi67
 
java01.ppt
FakeBuddy2
 
Ad

More from Madishetty Prathibha (12)

PPTX
Object Oriented programming - Introduction
Madishetty Prathibha
 
PPTX
Access modifiers in java
Madishetty Prathibha
 
PPTX
Constructor in java
Madishetty Prathibha
 
PPTX
Control statements in java
Madishetty Prathibha
 
PPTX
Operators in java
Madishetty Prathibha
 
PPTX
Types of datastructures
Madishetty Prathibha
 
PPTX
Introduction to algorithms
Madishetty Prathibha
 
PDF
Java data types, variables and jvm
Madishetty Prathibha
 
PPTX
Introduction to data structures (ss)
Madishetty Prathibha
 
PDF
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
PPT
Java features
Madishetty Prathibha
 
PPSX
Introduction of java
Madishetty Prathibha
 
Object Oriented programming - Introduction
Madishetty Prathibha
 
Access modifiers in java
Madishetty Prathibha
 
Constructor in java
Madishetty Prathibha
 
Control statements in java
Madishetty Prathibha
 
Operators in java
Madishetty Prathibha
 
Types of datastructures
Madishetty Prathibha
 
Introduction to algorithms
Madishetty Prathibha
 
Java data types, variables and jvm
Madishetty Prathibha
 
Introduction to data structures (ss)
Madishetty Prathibha
 
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Java features
Madishetty Prathibha
 
Introduction of java
Madishetty Prathibha
 
Ad

Recently uploaded (20)

PPTX
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PPTX
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PDF
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
PPTX
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
PPTX
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PPTX
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
PPTX
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
PPTX
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PDF
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
Introduction to Indian Writing in English
Trushali Dodiya
 
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
Introduction presentation of the patentbutler tool
MIPLM
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 

Structure of java program diff c- cpp and java

  • 2. Topics for Today’s Session Differences between C, C++ & Java Structure of a Java Program
  • 3. Differences between C, C++ and Java Feature C C++ Java Programming Paradigm Procedural language Object-Oriented Programming (OOP) Pure Object Oriented Oriented Origin Based on assembly language Based on C language Based on C and C++ Developer Dennis Ritchie in 1972 Bjarne Stroustrup in 1979 James Gosling in 1991 Translator Compiler only Compiler only Interpreted language (Compiler + interpreter) Platform Dependency Platform Dependent Platform Dependent Platform Independent Code execution Direct Direct Executed by JVM Approach Top-down Bottom-up Bottom-up File generation .exe files .exe files .class files Pre-processor directives Support header files (#include, #define) Supported (#header, #define) Use Packages (import) keywords 32 keywords 63 keywords 50 keywords
  • 4. Contd.. Feature C C++ Java Datatypes (union, structure) Supported Supported Not supported Inheritance No inheritance Supported Supported except Multiple inheritance Overloading No overloading Support Function overloading (Polymorphism) Operator overloading is not supported Pointers Supported Supported Not supported Allocation Use malloc, calloc Use new, delete Garbage collector Exception Handling Not supported Supported Supported Templates Not supported Supported Not supported Destructors No constructor neither destructor Supported Not supported Multithreading/ Interfaces Not supported Not supported Supported Database connectivity Not supported Not supported Supported Storage Classes Supported ( auto, extern ) Supported ( auto, extern ) Not supported
  • 5. Structure of a Java Program
  • 6. Documentation Section:  It includes the comments that improve the readability of the program.  It consists comments in Java that describe the purpose of the program, author name, date and time of program creation.  This section is optional and comments may appear anywhere in the program. Java programming language supports three types of comments..  Single line Comment (or end-of line comment)  It starts with a double slash symbol (//) and terminates at the end of the current line. Ex: // sum of two numbers  Multi-line Comment /* a multi-line comment is declared like this and can have multiple lines as a comment */  Documentation Comment  /** a documentation comment starts with a delimiter and ends with */
  • 7. Package Statement  A package is a collection of classes, interfaces and sub- packages.  A sub package contains collection of classes, interfaces and sub-sub packages etc.  There is a provision in Java that allows you to declare your classes in a collection called package.  There can be only one package statement in a Java program.  It must appear as the first statement in the source code file before any class or interface declaration.  This statement is optional, Syntax: package package_name; Example: package student;  This statement declares that all the classes and interfaces defined in this source file are a part of the student package. java.lang.*; package is imported by default and this package is known as default package.
  • 8. Import Statement  Many predefined classes are stored in packages in Java, an import statement is used to refer to the classes stored in other packages.  An import statement is always written after the package statement but it has to be before any class declaration.  You can import a specific class or all the classes of the package.  Many classes can be imported in a single program and hence multiple import statements can be written. import java.util.Date; //imports the date class import java.applet.*; //imports all the classes from the java applet package
  • 9. Interface Section  This section is used to specify an interface in Java.  It is an optional section which is mainly used to implement multiple inheritance in Java  An interface is similar to a class but contains only constants and method declarations.  An Interfaces cannot be instantiated.  They can only be implemented by classes or extended by other interfaces. Interface shape{ void draw(int length, int bredth); void show(); }
  • 10. Class Definition  Java program may contain multiple class definition.  Classes are primary feature of Java program.  The classes are used to map real world problems.  classes defines the information about the user-defined classes in a program.  A class is a collection of variables and methods that operate on the fields.  Every program in Java will have at least one class with the main method. class Addition { void add(String args[]) { int a=2, b=3, c; c=a+b; System.out.println(c); } }
  • 11. Main Method Class  Execution of a Java application starts from the main method.  In other words, its an entry point for the class or program that starts in Java Run-time.  The main () method which is from where the execution of program actually starts and follow the statements in the order specified.  The main method can create objects, evaluate expressions, and invoke other methods and much more.  On reaching the end of main, the program terminates and control passes back to the operating system.  The class section is mandatory. // Program to display message on the screen class HelloJava { public static void main(String args[]) { System.out.println("Hello Harsha"); } }
  • 12. Summary  In this lesson you learnt about  Java  Differences between C , C++ and Java  Structure of Java Program