SlideShare a Scribd company logo
Simple java program
Class Sampleone
{
public static void main(String args[])
{
System.out.println(“Java is better than C++”);
}
}
Class Declaration:
Class Sampleone
declares a class, which is an object-oriented construct. Java
is a true object oriented language and therefore ,
everything must be placed inside a class.
Class is a keyword and declares that a new class definition
follows. Sample one is a identifier that specifies the name of
the class to be defined.
Opening Brace:
Every class definition in java begins with an opening
brace “{“ and ends with a matching closing brace”}”.
The Main Line:
public static void main(String args[])
define a method name main. Every java program must
include the main()method. Java application can have any
number of classes but only one must include a main
method .
This line contains a number of keywords public,
static and void
Public The keyword public is an access specifier that
declares the main method it accessible to all
other classes. This is similar to the C++ public
modifier.
Static The Keyword static, which declares this
method as one that belong to the entire class
and not a part of any objects of the class.
Void The type modifier void states that the main
method does not return any value.
The Output Line:
System.out.println(“Java is better than C++”);
This is similar to printf() statement of C or cout <<
constructor of C++. Every method must be an object.
The println method is a member of the out object, is a
static data member of system class.
Java is better than C++
The method pritnln always appends a newline
character to the end of the string .
Every java statement must be end with a
semicolon.
Ad

More Related Content

What's hot (20)

Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
Kuntal Bhowmick
 
Java program structure
Java program structure Java program structure
Java program structure
Mukund Kumar Bharti
 
Introduction to java
Introduction to  javaIntroduction to  java
Introduction to java
Kalai Selvi
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
Raghu nath
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
talha ijaz
 
Unit 4 Java
Unit 4 JavaUnit 4 Java
Unit 4 Java
arnold 7490
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
talha ijaz
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
Elizabeth alexander
 
Unit3 packages &amp; interfaces
Unit3 packages &amp; interfacesUnit3 packages &amp; interfaces
Unit3 packages &amp; interfaces
Kalai Selvi
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
bhuvaneshwariA5
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
Arjun Shanka
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
Madishetty Prathibha
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
TharuniDiddekunta
 
Classes, objects, methods, constructors, this keyword in java
Classes, objects, methods, constructors, this keyword  in javaClasses, objects, methods, constructors, this keyword  in java
Classes, objects, methods, constructors, this keyword in java
TharuniDiddekunta
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
COMSATS Institute of Information Technology
 
150950107056 2150704
150950107056 2150704150950107056 2150704
150950107056 2150704
Prashant Mokani
 
Inheritance used in java
Inheritance used in javaInheritance used in java
Inheritance used in java
TharuniDiddekunta
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In Java
CharthaGaglani
 
Packages
PackagesPackages
Packages
Ravi Kant Sahu
 

Similar to Simple java program (20)

oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
CPD INDIA
 
java tutorial 4
 java tutorial 4 java tutorial 4
java tutorial 4
Tushar Desarda
 
Java8 features
Java8 featuresJava8 features
Java8 features
Elias Hasnat
 
Objects and classes in OO Programming concepts
Objects and classes in OO Programming conceptsObjects and classes in OO Programming concepts
Objects and classes in OO Programming concepts
researchveltech
 
UNIT 1 : object oriented programming.pptx
UNIT 1 : object oriented programming.pptxUNIT 1 : object oriented programming.pptx
UNIT 1 : object oriented programming.pptx
amanuel236786
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Java interview
Java interviewJava interview
Java interview
Mohammad Shahban
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Ayes Chinmay
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
G C Reddy Technologies
 
this keyword in Java.pdf
this keyword in Java.pdfthis keyword in Java.pdf
this keyword in Java.pdf
ParvizMirzayev2
 
Abstraction encapsulation inheritance polymorphism
Abstraction encapsulation inheritance polymorphismAbstraction encapsulation inheritance polymorphism
Abstraction encapsulation inheritance polymorphism
PriyadharshiniG41
 
Java 06
Java 06Java 06
Java 06
Loida Igama
 
15 interfaces
15   interfaces15   interfaces
15 interfaces
dhrubo kayal
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdf
venud11
 
Basics of java (1)
Basics of java (1)Basics of java (1)
Basics of java (1)
raj upadhyay
 
Basic concept of class, method , command line-argument
Basic concept of class, method , command line-argumentBasic concept of class, method , command line-argument
Basic concept of class, method , command line-argument
Suresh Mohta
 
Core Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHatCore Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHat
Scholarhat
 
classes-objects in oops java-201023154255.pptx
classes-objects in oops java-201023154255.pptxclasses-objects in oops java-201023154255.pptx
classes-objects in oops java-201023154255.pptx
janetvidyaanancys
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
Debasish Pratihari
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
Archana Gopinath
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
CPD INDIA
 
Objects and classes in OO Programming concepts
Objects and classes in OO Programming conceptsObjects and classes in OO Programming concepts
Objects and classes in OO Programming concepts
researchveltech
 
UNIT 1 : object oriented programming.pptx
UNIT 1 : object oriented programming.pptxUNIT 1 : object oriented programming.pptx
UNIT 1 : object oriented programming.pptx
amanuel236786
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Ayes Chinmay
 
this keyword in Java.pdf
this keyword in Java.pdfthis keyword in Java.pdf
this keyword in Java.pdf
ParvizMirzayev2
 
Abstraction encapsulation inheritance polymorphism
Abstraction encapsulation inheritance polymorphismAbstraction encapsulation inheritance polymorphism
Abstraction encapsulation inheritance polymorphism
PriyadharshiniG41
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdf
venud11
 
Basics of java (1)
Basics of java (1)Basics of java (1)
Basics of java (1)
raj upadhyay
 
Basic concept of class, method , command line-argument
Basic concept of class, method , command line-argumentBasic concept of class, method , command line-argument
Basic concept of class, method , command line-argument
Suresh Mohta
 
Core Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHatCore Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHat
Scholarhat
 
classes-objects in oops java-201023154255.pptx
classes-objects in oops java-201023154255.pptxclasses-objects in oops java-201023154255.pptx
classes-objects in oops java-201023154255.pptx
janetvidyaanancys
 
Ad

More from shalinikarunakaran1 (16)

FILES CONCEPTS IN PYTHON PROGRAMMING.pptx
FILES CONCEPTS IN PYTHON PROGRAMMING.pptxFILES CONCEPTS IN PYTHON PROGRAMMING.pptx
FILES CONCEPTS IN PYTHON PROGRAMMING.pptx
shalinikarunakaran1
 
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICSINTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
shalinikarunakaran1
 
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICSINTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
shalinikarunakaran1
 
COLOR MODELS IN RGB COLOR (INTRODUCTION)
COLOR MODELS IN RGB COLOR (INTRODUCTION)COLOR MODELS IN RGB COLOR (INTRODUCTION)
COLOR MODELS IN RGB COLOR (INTRODUCTION)
shalinikarunakaran1
 
Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)
shalinikarunakaran1
 
Character generation
Character generationCharacter generation
Character generation
shalinikarunakaran1
 
Character attributes
Character attributesCharacter attributes
Character attributes
shalinikarunakaran1
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
shalinikarunakaran1
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Video display devices
Video display devicesVideo display devices
Video display devices
shalinikarunakaran1
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
shalinikarunakaran1
 
Introduction , surveuy on cg
Introduction , surveuy on cgIntroduction , surveuy on cg
Introduction , surveuy on cg
shalinikarunakaran1
 
Java tokens
Java tokensJava tokens
Java tokens
shalinikarunakaran1
 
How java differs from c and c++
How java differs from c and c++How java differs from c and c++
How java differs from c and c++
shalinikarunakaran1
 
JAVA HISTORY
JAVA HISTORYJAVA HISTORY
JAVA HISTORY
shalinikarunakaran1
 
JAVA FEATURES
JAVA FEATURESJAVA FEATURES
JAVA FEATURES
shalinikarunakaran1
 
FILES CONCEPTS IN PYTHON PROGRAMMING.pptx
FILES CONCEPTS IN PYTHON PROGRAMMING.pptxFILES CONCEPTS IN PYTHON PROGRAMMING.pptx
FILES CONCEPTS IN PYTHON PROGRAMMING.pptx
shalinikarunakaran1
 
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICSINTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
INTRODUCTION TO KEY FRAME SYSTEMS IN COMPUTER GRAPHICS
shalinikarunakaran1
 
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICSINTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
INTRODUCTION TO CMY COLOR MODELS IN COMPUTER GRAPHICS
shalinikarunakaran1
 
COLOR MODELS IN RGB COLOR (INTRODUCTION)
COLOR MODELS IN RGB COLOR (INTRODUCTION)COLOR MODELS IN RGB COLOR (INTRODUCTION)
COLOR MODELS IN RGB COLOR (INTRODUCTION)
shalinikarunakaran1
 
Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)
shalinikarunakaran1
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
shalinikarunakaran1
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
shalinikarunakaran1
 
Ad

Recently uploaded (20)

Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdfIPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
Quiz Club of PSG College of Arts & Science
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
PUBH1000 Slides - Module 11: Governance for Health
PUBH1000 Slides - Module 11: Governance for HealthPUBH1000 Slides - Module 11: Governance for Health
PUBH1000 Slides - Module 11: Governance for Health
JonathanHallett4
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
PoojaSen20
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
PUBH1000 Slides - Module 11: Governance for Health
PUBH1000 Slides - Module 11: Governance for HealthPUBH1000 Slides - Module 11: Governance for Health
PUBH1000 Slides - Module 11: Governance for Health
JonathanHallett4
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
PoojaSen20
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 

Simple java program

  • 2. Class Sampleone { public static void main(String args[]) { System.out.println(“Java is better than C++”); } } Class Declaration: Class Sampleone declares a class, which is an object-oriented construct. Java is a true object oriented language and therefore , everything must be placed inside a class. Class is a keyword and declares that a new class definition follows. Sample one is a identifier that specifies the name of the class to be defined.
  • 3. Opening Brace: Every class definition in java begins with an opening brace “{“ and ends with a matching closing brace”}”. The Main Line: public static void main(String args[]) define a method name main. Every java program must include the main()method. Java application can have any number of classes but only one must include a main method .
  • 4. This line contains a number of keywords public, static and void Public The keyword public is an access specifier that declares the main method it accessible to all other classes. This is similar to the C++ public modifier. Static The Keyword static, which declares this method as one that belong to the entire class and not a part of any objects of the class. Void The type modifier void states that the main method does not return any value.
  • 5. The Output Line: System.out.println(“Java is better than C++”); This is similar to printf() statement of C or cout << constructor of C++. Every method must be an object. The println method is a member of the out object, is a static data member of system class. Java is better than C++ The method pritnln always appends a newline character to the end of the string . Every java statement must be end with a semicolon.
  翻译: