SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

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