SlideShare a Scribd company logo
Getting to know your Programming Environment
Objectives At the end of the lesson, the student should be able to: ●  Create a Java program using text editor and console in the Linux, Solaris, Windows, Mac OS, or any other OS environment ●  Differentiate between syntax-errors and runtime errors ●  Create a Java program using NetBeans
Definitions ● Console – This is where you type in commands – Examples are Terminal (Linux), MSDOS Command Prompt (Windows)
Definitions ●  Text Editor –  Examples: Notepad, Wordpad, Vi
Definitions ● Integrated Development Environment or IDE – a programming environment integrated into a software application that provides a GUI builder, a text or code editor, a compiler and/or interpreter and a debugger.
My First Java Program 1 public class Hello { 2 3 /** 4 * My first Java program 5 */ 6 public static void main( String[] args ){ 7 8 //prints the string “Hello world” on screen 9 System.out.println(“Hello world”); 10 11 } 12 }
Using Text Editor and Console ● Step 1: Start the Text Editor – To start the Text Editor in Linux, click on Menu-> Accessories-> Text Editor ● Step 2: Open Terminal – To open Terminal in Linux, click on Menu-> System Tools-> Terminal ● Step 3: Write your the source code of your Java program in the Text Editor
Using Text Editor and Console ●  Step 4: Save your Java Program –  Filename: Hello.java –  Folder name: myjavaprograms –  To open the Save dialog box, click on the File menu found on the menubar and then click on Save. –  If the folder myjavaprograms does not exist yet, create the folder
Using Text Editor and Console ●  Step 5: Compiling your program –  Go to the Terminal window –  Go to the folder myjavaprograms where you saved the program –  To compile a Java program, we type in the command: javac [filename] –  So in this case, type in: javac Hello.java During compilation, javac adds a file to the disk called [filename].class, or in this case, Hello.class, which is the actual bytecode.
Using Text Editor and Console ● Step 6: Running the Program – To run your Java program, type in the command: java [filename without the extension] – so in the case of our example, type in: java Hello – You can see on the screen after running the program: "Hello world!"
Using NetBeans IDE
Using NetBeans IDE
Using NetBeans IDE
Using NetBeans IDE
Using NetBeans IDE
Using NetBeans IDE
Using NetBeans IDE
1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
6.Can we write more than one main() method in a class ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
Errors : Syntax Errors ● Syntax Errors Syntax – errors are usually typing errors ● Common Syntax Errors: – misspelled a command in Java – forgot to write a semi-colon at the end of a statement
Example: Syntax Error
Example: Syntax Error
About  main()  method Calling non-static method from main() : Syntax Error
About  main()  method Calling static method :Correct Syntax
About  main()  method In different flavor  :Type 1
About  main()  method In different flavor  :Type 2
About  main()  method In different flavor  :Type 3
About  main()  method Type 1:Runtime error
About  main()  method Type 1a:Runtime error
About  main()  method Type 1b:Runtime error
About  main()  method Type 2:Runtime error
About  main()  method Type 2a:Runtime error
About  main()  method Type 3:Runtime error (without static)
About  main()  method Type 4:Runtime error (without “public”  i.e “default” modifier )
About  main()  method Type 4a:Runtime error (should use “public” modifier)
About  main()  method Type 5:Runtime error (return type should be “void”)
Errors: Runtime Errors ● Run-time Errors – errors that will not display until you run or execute your program – Even programs that compile successfully may display wrong answers if the programmer has not thought through the logical processes and structures of the program. – Examples: ● You want your program to print 100 strings of “Hello world”, but it only printed 99. ● Your program gets an input from the
Summary ● My First Java Program ● Using a Text Editor and Console – Write program – Compile program – Run program ● Errors – Syntax Errors – Runtime Errors

More Related Content

Viewers also liked

Modern United States
Modern United StatesModern United States
Modern United States
Kris Hagans
 
Kade Hagans Racing Photos
Kade Hagans Racing PhotosKade Hagans Racing Photos
Kade Hagans Racing PhotosKris Hagans
 
Web 2 Nel
Web 2 NelWeb 2 Nel
Exploration
ExplorationExploration
Exploration
Kris Hagans
 
Viget bw-digital east-1109
Viget bw-digital east-1109Viget bw-digital east-1109
Viget bw-digital east-1109
Brian Williams
 
Forest Footprint Disclosure: 2009 Annual Review Launch
Forest Footprint Disclosure: 2009 Annual Review LaunchForest Footprint Disclosure: 2009 Annual Review Launch
Forest Footprint Disclosure: 2009 Annual Review Launch
forestdisclosure
 
Half Term Homework Biology Questions
Half Term Homework Biology QuestionsHalf Term Homework Biology Questions
Half Term Homework Biology Questionsgueste6fc85
 
Use Case for Supplier Mangement Application - Zoho
Use Case for Supplier Mangement Application - ZohoUse Case for Supplier Mangement Application - Zoho
Use Case for Supplier Mangement Application - ZohoRohit Khandelwal
 
Early United States
Early United States Early United States
Early United States
Kris Hagans
 
Iowa Soccer Level 3 league in the Greater Des Moines area: initial proposal
Iowa Soccer Level 3 league in the Greater Des Moines area:  initial proposalIowa Soccer Level 3 league in the Greater Des Moines area:  initial proposal
Iowa Soccer Level 3 league in the Greater Des Moines area: initial proposal
Iowa Soccer Association
 
Civil War Era
Civil War EraCivil War Era
Civil War Era
Kris Hagans
 
MIS/Web2.0 Project on Matrimony Websites
MIS/Web2.0 Project on Matrimony WebsitesMIS/Web2.0 Project on Matrimony Websites
MIS/Web2.0 Project on Matrimony Websites
Rohit Khandelwal
 
Action Research Leads to Teacher Initiated Changes in ICT integration
Action Research Leads to Teacher Initiated Changes in ICT integrationAction Research Leads to Teacher Initiated Changes in ICT integration
Action Research Leads to Teacher Initiated Changes in ICT integration
College Ste-Anne de Lachine
 
Age of Revolution
Age of RevolutionAge of Revolution
Age of Revolution
Kris Hagans
 
romi pictures
romi picturesromi pictures
romi pictures
Romi Rohmawan
 
ErőSzak A TelevíZióBan
ErőSzak A TelevíZióBanErőSzak A TelevíZióBan
ErőSzak A TelevíZióBan
EKTF
 

Viewers also liked (16)

Modern United States
Modern United StatesModern United States
Modern United States
 
Kade Hagans Racing Photos
Kade Hagans Racing PhotosKade Hagans Racing Photos
Kade Hagans Racing Photos
 
Web 2 Nel
Web 2 NelWeb 2 Nel
Web 2 Nel
 
Exploration
ExplorationExploration
Exploration
 
Viget bw-digital east-1109
Viget bw-digital east-1109Viget bw-digital east-1109
Viget bw-digital east-1109
 
Forest Footprint Disclosure: 2009 Annual Review Launch
Forest Footprint Disclosure: 2009 Annual Review LaunchForest Footprint Disclosure: 2009 Annual Review Launch
Forest Footprint Disclosure: 2009 Annual Review Launch
 
Half Term Homework Biology Questions
Half Term Homework Biology QuestionsHalf Term Homework Biology Questions
Half Term Homework Biology Questions
 
Use Case for Supplier Mangement Application - Zoho
Use Case for Supplier Mangement Application - ZohoUse Case for Supplier Mangement Application - Zoho
Use Case for Supplier Mangement Application - Zoho
 
Early United States
Early United States Early United States
Early United States
 
Iowa Soccer Level 3 league in the Greater Des Moines area: initial proposal
Iowa Soccer Level 3 league in the Greater Des Moines area:  initial proposalIowa Soccer Level 3 league in the Greater Des Moines area:  initial proposal
Iowa Soccer Level 3 league in the Greater Des Moines area: initial proposal
 
Civil War Era
Civil War EraCivil War Era
Civil War Era
 
MIS/Web2.0 Project on Matrimony Websites
MIS/Web2.0 Project on Matrimony WebsitesMIS/Web2.0 Project on Matrimony Websites
MIS/Web2.0 Project on Matrimony Websites
 
Action Research Leads to Teacher Initiated Changes in ICT integration
Action Research Leads to Teacher Initiated Changes in ICT integrationAction Research Leads to Teacher Initiated Changes in ICT integration
Action Research Leads to Teacher Initiated Changes in ICT integration
 
Age of Revolution
Age of RevolutionAge of Revolution
Age of Revolution
 
romi pictures
romi picturesromi pictures
romi pictures
 
ErőSzak A TelevíZióBan
ErőSzak A TelevíZióBanErőSzak A TelevíZióBan
ErőSzak A TelevíZióBan
 

Similar to 2 Getting To Know Your Programing Environment

java 1 new.pdf
java 1 new.pdfjava 1 new.pdf
java 1 new.pdf
SulSya
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
Vijay Kankane
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
nahalomar
 
Unit2 java
Unit2 javaUnit2 java
Unit2 javamrecedu
 
Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1
Mohamed Essam
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
Java Programming
Java ProgrammingJava Programming
Java Programming
Anjan Mahanta
 
Big Java Chapter 1
Big Java Chapter 1Big Java Chapter 1
Big Java Chapter 1
Maria Joslin
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
Ramlal Pawar
 
Java programming language basics
Java programming language basicsJava programming language basics
Java programming language basics
dharmendra kumar dhakar
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefge
bsnl007
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
loidasacueza
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire course
grades4u
 
lecture 6
 lecture 6 lecture 6
lecture 6
umardanjumamaiwada
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
umardanjumamaiwada
 
How java works
How java worksHow java works
How java works
RaxTonProduction
 

Similar to 2 Getting To Know Your Programing Environment (20)

java 1 new.pdf
java 1 new.pdfjava 1 new.pdf
java 1 new.pdf
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
Unit2 java
Unit2 javaUnit2 java
Unit2 java
 
Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Big Java Chapter 1
Big Java Chapter 1Big Java Chapter 1
Big Java Chapter 1
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
 
Java programming language basics
Java programming language basicsJava programming language basics
Java programming language basics
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefge
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire course
 
lecture 6
 lecture 6 lecture 6
lecture 6
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
01slide
01slide01slide
01slide
 
01slide
01slide01slide
01slide
 
How java works
How java worksHow java works
How java works
 
How java works
How java worksHow java works
How java works
 

Recently uploaded

Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
LuanWise
 
Examining the Effect of Customer Services Quality and Online Reviews in Unive...
Examining the Effect of Customer Services Quality and Online Reviews in Unive...Examining the Effect of Customer Services Quality and Online Reviews in Unive...
Examining the Effect of Customer Services Quality and Online Reviews in Unive...
Adam Smith
 
Understanding User Needs and Satisfying Them
Understanding User Needs and Satisfying ThemUnderstanding User Needs and Satisfying Them
Understanding User Needs and Satisfying Them
Aggregage
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
dylandmeas
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
Aurelien Domont, MBA
 
Recruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media MasterclassRecruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media Masterclass
LuanWise
 
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
AnnySerafinaLove
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
taqyed
 
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
SOFTTECHHUB
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
Nicola Wreford-Howard
 
amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05
marketing317746
 
Top mailing list providers in the USA.pptx
Top mailing list providers in the USA.pptxTop mailing list providers in the USA.pptx
Top mailing list providers in the USA.pptx
JeremyPeirce1
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
tanyjahb
 
Authentically Social by Corey Perlman - EO Puerto Rico
Authentically Social by Corey Perlman - EO Puerto RicoAuthentically Social by Corey Perlman - EO Puerto Rico
Authentically Social by Corey Perlman - EO Puerto Rico
Corey Perlman, Social Media Speaker and Consultant
 
Best Forex Brokers Comparison in INDIA 2024
Best Forex Brokers Comparison in INDIA 2024Best Forex Brokers Comparison in INDIA 2024
Best Forex Brokers Comparison in INDIA 2024
Top Forex Brokers Review
 
Company Valuation webinar series - Tuesday, 4 June 2024
Company Valuation webinar series - Tuesday, 4 June 2024Company Valuation webinar series - Tuesday, 4 June 2024
Company Valuation webinar series - Tuesday, 4 June 2024
FelixPerez547899
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
balatucanapplelovely
 
-- June 2024 is National Volunteer Month --
-- June 2024 is National Volunteer Month ---- June 2024 is National Volunteer Month --
-- June 2024 is National Volunteer Month --
NZSG
 
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdfThe 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
thesiliconleaders
 
The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
Adam Smith
 

Recently uploaded (20)

Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
 
Examining the Effect of Customer Services Quality and Online Reviews in Unive...
Examining the Effect of Customer Services Quality and Online Reviews in Unive...Examining the Effect of Customer Services Quality and Online Reviews in Unive...
Examining the Effect of Customer Services Quality and Online Reviews in Unive...
 
Understanding User Needs and Satisfying Them
Understanding User Needs and Satisfying ThemUnderstanding User Needs and Satisfying Them
Understanding User Needs and Satisfying Them
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
 
Recruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media MasterclassRecruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media Masterclass
 
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
 
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
Hamster Kombat' Telegram Game Surpasses 100 Million Players—Token Release Sch...
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
 
amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05
 
Top mailing list providers in the USA.pptx
Top mailing list providers in the USA.pptxTop mailing list providers in the USA.pptx
Top mailing list providers in the USA.pptx
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
 
Authentically Social by Corey Perlman - EO Puerto Rico
Authentically Social by Corey Perlman - EO Puerto RicoAuthentically Social by Corey Perlman - EO Puerto Rico
Authentically Social by Corey Perlman - EO Puerto Rico
 
Best Forex Brokers Comparison in INDIA 2024
Best Forex Brokers Comparison in INDIA 2024Best Forex Brokers Comparison in INDIA 2024
Best Forex Brokers Comparison in INDIA 2024
 
Company Valuation webinar series - Tuesday, 4 June 2024
Company Valuation webinar series - Tuesday, 4 June 2024Company Valuation webinar series - Tuesday, 4 June 2024
Company Valuation webinar series - Tuesday, 4 June 2024
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
 
-- June 2024 is National Volunteer Month --
-- June 2024 is National Volunteer Month ---- June 2024 is National Volunteer Month --
-- June 2024 is National Volunteer Month --
 
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdfThe 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
 
The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
 

2 Getting To Know Your Programing Environment

  • 1. Getting to know your Programming Environment
  • 2. Objectives At the end of the lesson, the student should be able to: ● Create a Java program using text editor and console in the Linux, Solaris, Windows, Mac OS, or any other OS environment ● Differentiate between syntax-errors and runtime errors ● Create a Java program using NetBeans
  • 3. Definitions ● Console – This is where you type in commands – Examples are Terminal (Linux), MSDOS Command Prompt (Windows)
  • 4. Definitions ● Text Editor – Examples: Notepad, Wordpad, Vi
  • 5. Definitions ● Integrated Development Environment or IDE – a programming environment integrated into a software application that provides a GUI builder, a text or code editor, a compiler and/or interpreter and a debugger.
  • 6. My First Java Program 1 public class Hello { 2 3 /** 4 * My first Java program 5 */ 6 public static void main( String[] args ){ 7 8 //prints the string “Hello world” on screen 9 System.out.println(“Hello world”); 10 11 } 12 }
  • 7. Using Text Editor and Console ● Step 1: Start the Text Editor – To start the Text Editor in Linux, click on Menu-> Accessories-> Text Editor ● Step 2: Open Terminal – To open Terminal in Linux, click on Menu-> System Tools-> Terminal ● Step 3: Write your the source code of your Java program in the Text Editor
  • 8. Using Text Editor and Console ● Step 4: Save your Java Program – Filename: Hello.java – Folder name: myjavaprograms – To open the Save dialog box, click on the File menu found on the menubar and then click on Save. – If the folder myjavaprograms does not exist yet, create the folder
  • 9. Using Text Editor and Console ● Step 5: Compiling your program – Go to the Terminal window – Go to the folder myjavaprograms where you saved the program – To compile a Java program, we type in the command: javac [filename] – So in this case, type in: javac Hello.java During compilation, javac adds a file to the disk called [filename].class, or in this case, Hello.class, which is the actual bytecode.
  • 10. Using Text Editor and Console ● Step 6: Running the Program – To run your Java program, type in the command: java [filename without the extension] – so in the case of our example, type in: java Hello – You can see on the screen after running the program: "Hello world!"
  • 18. 1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
  • 19. 6.Can we write more than one main() method in a class ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
  • 20. 1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
  • 21. 1.What is the name of the package here? 2.Can we create program without package? 3.What is the name of class? 4.What is the difference between class and Class? 5. we are writing main() method to execute program. why not other name like m1()? 6.Can we write more than one main() method ? 7.Why main() method is public? 8.Why main() method is static? 9.Can we write main() method with different argument? Quiz :
  • 22. Errors : Syntax Errors ● Syntax Errors Syntax – errors are usually typing errors ● Common Syntax Errors: – misspelled a command in Java – forgot to write a semi-colon at the end of a statement
  • 25. About main() method Calling non-static method from main() : Syntax Error
  • 26. About main() method Calling static method :Correct Syntax
  • 27. About main() method In different flavor :Type 1
  • 28. About main() method In different flavor :Type 2
  • 29. About main() method In different flavor :Type 3
  • 30. About main() method Type 1:Runtime error
  • 31. About main() method Type 1a:Runtime error
  • 32. About main() method Type 1b:Runtime error
  • 33. About main() method Type 2:Runtime error
  • 34. About main() method Type 2a:Runtime error
  • 35. About main() method Type 3:Runtime error (without static)
  • 36. About main() method Type 4:Runtime error (without “public” i.e “default” modifier )
  • 37. About main() method Type 4a:Runtime error (should use “public” modifier)
  • 38. About main() method Type 5:Runtime error (return type should be “void”)
  • 39. Errors: Runtime Errors ● Run-time Errors – errors that will not display until you run or execute your program – Even programs that compile successfully may display wrong answers if the programmer has not thought through the logical processes and structures of the program. – Examples: ● You want your program to print 100 strings of “Hello world”, but it only printed 99. ● Your program gets an input from the
  • 40. Summary ● My First Java Program ● Using a Text Editor and Console – Write program – Compile program – Run program ● Errors – Syntax Errors – Runtime Errors