SlideShare uma empresa Scribd logo
1 de 40
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

Mais conteúdo relacionado

Semelhante a 2 Getting To Know Your Programing Environment

java 1 new.pdf
java 1 new.pdfjava 1 new.pdf
java 1 new.pdfSulSya
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manualnahalomar
 
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 1Mohamed 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 StartedMartin Chapman
 
Big Java Chapter 1
Big Java Chapter 1Big Java Chapter 1
Big Java Chapter 1Maria Joslin
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introductionRamlal Pawar
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefgebsnl007
 
Unit of competency
Unit of competencyUnit of competency
Unit of competencyloidasacueza
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire coursegrades4u
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 

Semelhante a 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
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

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