SlideShare une entreprise Scribd logo
1  sur  23
Java Hello World Program
By JavaWithUs ( www.javawithus.com )
The Program
First, let us look at the complete program :
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
The output will be :
Hello World
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
public is an access specifier which states that
the class is accessible from any other class
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
class defines a class or in simpler words – a
program
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
HelloWorld is the name of the class ( or
program ). You can give any other name
BUT…
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
… that name should follow the rules of identifiers :
1. It should begin with a letter
2. Lowercase letters, upper case letters and
numbers can be used. Only $ and _ special
characters are allowed.
3. Keywords ( certain reserved words ) cannot be
used as identifiers.
4. Spaces are not allowed.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
The opening and closing braces specify the
starting and ending of the class.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
Within the class, we have a method.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
The method has a header or method
declaration ….
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
… and a body
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
The word public in the method header is the
same as the keyword public used for the
class. Here, it indicates that other classes
can call this method.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
static specifies that we can invoke this
method without creating an object of the
class.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
void indicates that the method does not
return any value.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
main is the name of the method. For a
program to be run, the name of the method
should always be main.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
With the parentheses are the arguments.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
It takes a String array as an arguments and
stores it in the variable args.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
A String is a group of letters. An array is a
group of Strings.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
The parameters to main method are passed
through command line.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
This line prints the message to the screen.
Anything within the quotes is displayed on
the screen.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Hello World” );
}
}
System is a predefined class. out is a
member of that class and println is a
method.
public class HelloWorld {
public static void main ( String[] args ) {
System.out.println ( “Welcome to JavaWithUs.com” );
}
}
The above modified program prints
Welcome to JavaWithUs.com
To understand the HelloWorld program in a
better way, read the following article :
http://www.javawithus.com/tutorial/the-
hello-world-program
Learn Java through the tutorials on our
website.
http://www.javawithus.com/tutorial/
Presentation by
www.javawithus.com

Contenu connexe

Tendances

Tendances (20)

Java conditional statements
Java conditional statementsJava conditional statements
Java conditional statements
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Java interface
Java interfaceJava interface
Java interface
 
Java String
Java String Java String
Java String
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat Shahriyar
 
React hooks
React hooksReact hooks
React hooks
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
 
JAVA OOP
JAVA OOPJAVA OOP
JAVA OOP
 
JavaScript Conditional Statements
JavaScript Conditional StatementsJavaScript Conditional Statements
JavaScript Conditional Statements
 
Java - Generic programming
Java - Generic programmingJava - Generic programming
Java - Generic programming
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika Tutorials
 
JDBC
JDBCJDBC
JDBC
 
WHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVAWHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVA
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
 

Similaire à Java Hello World Program

[NHN NEXT] Java 강의 - Week1
[NHN NEXT] Java 강의 - Week1[NHN NEXT] Java 강의 - Week1
[NHN NEXT] Java 강의 - Week1Young-Ho Cho
 
Common errors v2
Common errors v2Common errors v2
Common errors v2ASU Online
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agentsRafael Winterhalter
 
Java Programs
Java ProgramsJava Programs
Java Programsvvpadhu
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Palak Sanghani
 
Java Programs Lab File
Java Programs Lab FileJava Programs Lab File
Java Programs Lab FileKandarp Tiwari
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークTsuyoshi Yamamoto
 
Inheritance Slides
Inheritance SlidesInheritance Slides
Inheritance SlidesAhsan Raja
 
Java Generics
Java GenericsJava Generics
Java Genericsjeslie
 
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、GaelykでハンズオンTsuyoshi Yamamoto
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Ayes Chinmay
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Javabackdoor
 

Similaire à Java Hello World Program (20)

Common errors
Common errorsCommon errors
Common errors
 
java input & output statements
 java input & output statements java input & output statements
java input & output statements
 
[NHN NEXT] Java 강의 - Week1
[NHN NEXT] Java 강의 - Week1[NHN NEXT] Java 강의 - Week1
[NHN NEXT] Java 강의 - Week1
 
Common errors v2
Common errors v2Common errors v2
Common errors v2
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agents
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Java Programs Lab File
Java Programs Lab FileJava Programs Lab File
Java Programs Lab File
 
Inheritance
InheritanceInheritance
Inheritance
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
Inheritance Slides
Inheritance SlidesInheritance Slides
Inheritance Slides
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Java Generics
Java GenericsJava Generics
Java Generics
 
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
OOPs & Inheritance Notes
OOPs & Inheritance NotesOOPs & Inheritance Notes
OOPs & Inheritance Notes
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 

Dernier

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 

Dernier (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 

Java Hello World Program

  • 1. Java Hello World Program By JavaWithUs ( www.javawithus.com )
  • 2. The Program First, let us look at the complete program : public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } The output will be : Hello World
  • 3. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } public is an access specifier which states that the class is accessible from any other class
  • 4. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } class defines a class or in simpler words – a program
  • 5. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } HelloWorld is the name of the class ( or program ). You can give any other name BUT…
  • 6. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } … that name should follow the rules of identifiers : 1. It should begin with a letter 2. Lowercase letters, upper case letters and numbers can be used. Only $ and _ special characters are allowed. 3. Keywords ( certain reserved words ) cannot be used as identifiers. 4. Spaces are not allowed.
  • 7. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } The opening and closing braces specify the starting and ending of the class.
  • 8. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } Within the class, we have a method.
  • 9. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } The method has a header or method declaration ….
  • 10. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } … and a body
  • 11. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } The word public in the method header is the same as the keyword public used for the class. Here, it indicates that other classes can call this method.
  • 12. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } static specifies that we can invoke this method without creating an object of the class.
  • 13. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } void indicates that the method does not return any value.
  • 14. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } main is the name of the method. For a program to be run, the name of the method should always be main.
  • 15. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } With the parentheses are the arguments.
  • 16. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } It takes a String array as an arguments and stores it in the variable args.
  • 17. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } A String is a group of letters. An array is a group of Strings.
  • 18. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } The parameters to main method are passed through command line.
  • 19. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } This line prints the message to the screen. Anything within the quotes is displayed on the screen.
  • 20. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Hello World” ); } } System is a predefined class. out is a member of that class and println is a method.
  • 21. public class HelloWorld { public static void main ( String[] args ) { System.out.println ( “Welcome to JavaWithUs.com” ); } } The above modified program prints Welcome to JavaWithUs.com
  • 22. To understand the HelloWorld program in a better way, read the following article : http://www.javawithus.com/tutorial/the- hello-world-program Learn Java through the tutorials on our website. http://www.javawithus.com/tutorial/