SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

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